xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] blktap2: Invalid logic detecting unaligned buffers in vhd_write_block
@ 2016-03-17 22:10 Ross Philipson
  2016-03-25 16:11 ` Wei Liu
  2016-04-06 14:39 ` Ian Jackson
  0 siblings, 2 replies; 12+ messages in thread
From: Ross Philipson @ 2016-03-17 22:10 UTC (permalink / raw)
  To: xen-devel

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@ainfosec.com>
---
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@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2016-07-06 13:16 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-17 22:10 [PATCH] blktap2: Invalid logic detecting unaligned buffers in vhd_write_block Ross Philipson
2016-03-25 16:11 ` Wei Liu
2016-03-25 16:34   ` Ross Philipson
2016-03-25 16:38     ` Wei Liu
2016-03-29 11:26     ` George Dunlap
2016-03-30 14:47       ` Ross Philipson
2016-04-06 16:51       ` Ross Philipson
2016-07-06 13:16         ` George Dunlap
2016-04-06 14:39 ` Ian Jackson
2016-04-06 15:25   ` Ross Philipson
2016-04-06 15:37   ` Ross Philipson
2016-04-07 16:37     ` Ian Jackson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).