iio: pressure: dlhl60d: Initialize empty DLH bytes
authorKees Cook <keescook@chromium.org>
Fri, 23 Feb 2024 17:29:39 +0000 (09:29 -0800)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Sun, 25 Feb 2024 12:11:31 +0000 (12:11 +0000)
commita1c9f508db2543aae59ea2378b07a026f6c917cf
tree4d2310dc09591f5b39c0ce03dd964088239051ba
parentdaec424cc57b33a28f8621eb7ac85f8bd327bd6b
iio: pressure: dlhl60d: Initialize empty DLH bytes

3 bytes were being read but 4 were being written. Explicitly initialize
the unused bytes to 0 and refactor the loop to use direct array
indexing, which appears to silence a Clang false positive warning[1].

Indent improvement included for readability of the fixed code.

Link: https://github.com/ClangBuiltLinux/linux/issues/2000
Fixes: ac78c6aa4a5d ("iio: pressure: Add driver for DLH pressure sensors")
Signed-off-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20240223172936.it.875-kees@kernel.org
Cc: <Stable@vger.kerenl.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/pressure/dlhl60d.c