projects
/
GitHub
/
moto-9609
/
android_kernel_motorola_exynos9610.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
80a49fd
)
iio: core: Fix suspicious sizeof usage
author
Orson Zhai
<orson.zhai@spreadtrum.com>
Tue, 25 Apr 2017 01:16:56 +0000
(09:16 +0800)
committer
Jonathan Cameron
<jic23@kernel.org>
Thu, 27 Apr 2017 05:30:52 +0000
(06:30 +0100)
Pointer size is variours in different system, say 32bit for 4 and 64bit
for 8. The 'sizeof(infomask)' may lead to wrong bit numbers.
Signed-off-by: Orson Zhai <orson.zhai@spreadtrum.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
drivers/iio/industrialio-core.c
patch
|
blob
|
blame
|
history
diff --git
a/drivers/iio/industrialio-core.c
b/drivers/iio/industrialio-core.c
index 3ff91e02fee346a244cfbce3c2143ce4c3fd2bf0..795f53c4d75d6e54ed58e58ca626192fb716079d 100644
(file)
--- a/
drivers/iio/industrialio-core.c
+++ b/
drivers/iio/industrialio-core.c
@@
-1089,7
+1089,7
@@
static int iio_device_add_info_mask_type(struct iio_dev *indio_dev,
{
int i, ret, attrcount = 0;
- for_each_set_bit(i, infomask, sizeof(infomask)*8) {
+ for_each_set_bit(i, infomask, sizeof(
*
infomask)*8) {
if (i >= ARRAY_SIZE(iio_chan_info_postfix))
return -EINVAL;
ret = __iio_add_chan_devattr(iio_chan_info_postfix[i],
@@
-1118,7
+1118,7
@@
static int iio_device_add_info_mask_type_avail(struct iio_dev *indio_dev,
int i, ret, attrcount = 0;
char *avail_postfix;
- for_each_set_bit(i, infomask, sizeof(infomask) * 8) {
+ for_each_set_bit(i, infomask, sizeof(
*
infomask) * 8) {
avail_postfix = kasprintf(GFP_KERNEL,
"%s_available",
iio_chan_info_postfix[i]);