Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

iio: buffer: document known issue

Add documentation explaining why the code which scans all available scan
masks is checking only a single long worth of bits even though the code
was intended to be supporting masks wider than single long.

Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
Link: https://lore.kernel.org/r/ef61c2c1e9a1c5e9f713f656871fdcb1652afdc2.1697452986.git.mazziesaccount@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

authored by

Matti Vaittinen and committed by
Jonathan Cameron
6543f376 2718f154

+16
+16
drivers/iio/industrialio-buffer.c
··· 413 413 { 414 414 if (bitmap_empty(mask, masklength)) 415 415 return NULL; 416 + /* 417 + * The condition here do not handle multi-long masks correctly. 418 + * It only checks the first long to be zero, and will use such mask 419 + * as a terminator even if there was bits set after the first long. 420 + * 421 + * Correct check would require using: 422 + * while (!bitmap_empty(av_masks, masklength)) 423 + * instead. This is potentially hazardous because the 424 + * avaliable_scan_masks is a zero terminated array of longs - and 425 + * using the proper bitmap_empty() check for multi-long wide masks 426 + * would require the array to be terminated with multiple zero longs - 427 + * which is not such an usual pattern. 428 + * 429 + * As writing of this no multi-long wide masks were found in-tree, so 430 + * the simple while (*av_masks) check is working. 431 + */ 416 432 while (*av_masks) { 417 433 if (strict) { 418 434 if (bitmap_equal(mask, av_masks, masklength))