On Sat, Jun 19, 2021 at 07:42:17AM +0200, Ahmad Fatoum wrote: > Doing unaligned near file end returns bogus results: > > barebox@Sandbox:/ md -s /dev/stickypage 4095 > 00000fff: 959ff8ff . > > That 0x959ff8 is heap memory next to the buffer md had allocated. > Fix this by adding some zeroed padding after the buffer, so it instead > reads: > > 00000fff: 000000ff . > > This is arguably better user experience. > This only applies to non-mappable fd's. For e.g. /dev/mem, unaligned > accesses will still be passed as-is. > > Signed-off-by: Ahmad Fatoum <ahmad@xxxxxx> > --- > commands/md.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) Applied, thanks Sascha > > diff --git a/commands/md.c b/commands/md.c > index ef6a1e1bc0b1..d80c7cca0ce4 100644 > --- a/commands/md.c > +++ b/commands/md.c > @@ -59,7 +59,7 @@ static int do_mem_md(int argc, char *argv[]) > goto out; > } > > - buf = xmalloc(RW_BUF_SIZE); > + buf = xzalloc(RW_BUF_SIZE + 7); > > do { > now = min(size, (loff_t)RW_BUF_SIZE); > -- > 2.32.0.rc0 > > > _______________________________________________ > barebox mailing list > barebox@xxxxxxxxxxxxxxxxxxx > http://lists.infradead.org/mailman/listinfo/barebox > -- Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list barebox@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/barebox