[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH] blktap2: Invalid logic detecting unaligned buffers in vhd_write_block
On 03/25/2016 12:11 PM, Wei Liu wrote: > On Thu, Mar 17, 2016 at 06:10:59PM -0400, Ross Philipson wrote: >> It seems the logic is meant to detect sector unaligned buffers for block >> writes. The NOTing of the logic instead masks off any unaligned bits and >> also would cause the function to always fail. It seems the function is not >> used in any of the tools so that is probably why the problem is not seen. >> In the vhd_read_block function it is correct. >> >> Signed-off-by: Ross Philipson <ross.philipson@xxxxxxxxxxxx> > > This seems to fall under tools umbrella. I've look at blktap2 code, > the reasoning is convincing to me so: > > Acked-by: Wei Liu <wei.liu2@xxxxxxxxxx> > > But I've never used blktap2 and we don't normally test it so I would > also wait a bit longer to see if anybody objects to this change. > > OOI if no code was using this, how did you discover this problem? We have an old fork of blktap2 from way back when. I was working to extract our changes and turn them into patches so we could rebase on upstream blktap2. Someone long ago found that - I have no idea how but it was a valid fix so I upstreamed it. There are a number of other ones that were found that are still in upstream blktap2 - I plan to send them too. > > Wei. > >> --- >> diff --git a/tools/blktap2/vhd/lib/libvhd.c b/tools/blktap2/vhd/lib/libvhd.c >> index 1fd5b4e..4ebe012 100644 >> --- a/tools/blktap2/vhd/lib/libvhd.c >> +++ b/tools/blktap2/vhd/lib/libvhd.c >> @@ -2188,7 +2188,7 @@ vhd_write_block(vhd_context_t *ctx, uint32_t block, >> char *data) >> if (block >= ctx->bat.entries) >> return -ERANGE; >> >> - if ((unsigned long)data & ~(VHD_SECTOR_SIZE -1)) >> + if ((unsigned long)data & (VHD_SECTOR_SIZE -1)) >> return -EINVAL; >> >> blk = ctx->bat.bat[block]; >> >> _______________________________________________ >> Xen-devel mailing list >> Xen-devel@xxxxxxxxxxxxx >> http://lists.xen.org/xen-devel -- Ross Philipson _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |