From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 68DFBC00144 for ; Mon, 1 Aug 2022 15:48:50 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B62658E0001; Mon, 1 Aug 2022 11:48:49 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B10FC6B0072; Mon, 1 Aug 2022 11:48:49 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9D8B98E0001; Mon, 1 Aug 2022 11:48:49 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 8C6C56B0071 for ; Mon, 1 Aug 2022 11:48:49 -0400 (EDT) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 66A8AAB029 for ; Mon, 1 Aug 2022 15:48:49 +0000 (UTC) X-FDA: 79751456778.24.55C10FC Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by imf02.hostedemail.com (Postfix) with ESMTP id 5E49E800EE for ; Mon, 1 Aug 2022 15:48:48 +0000 (UTC) Received: from fraeml734-chm.china.huawei.com (unknown [172.18.147.226]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4LxMr937gTz67M7g; Mon, 1 Aug 2022 23:44:41 +0800 (CST) Received: from lhrpeml500005.china.huawei.com (7.191.163.240) by fraeml734-chm.china.huawei.com (10.206.15.215) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Mon, 1 Aug 2022 17:48:45 +0200 Received: from localhost (10.202.226.42) by lhrpeml500005.china.huawei.com (7.191.163.240) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Mon, 1 Aug 2022 16:48:44 +0100 Date: Mon, 1 Aug 2022 16:48:43 +0100 From: Jonathan Cameron To: kernel test robot CC: LI Qingwu , , , Linux Memory Management List , Tomas Melin Subject: Re: [linux-next:master 2450/12552] drivers/iio/accel/sca3300.c:162:8: warning: Excessive padding in 'struct sca3300_chip_info' (17 padding bytes, where 1 is optimal). Optimal fields order: name, scan_masks, channels, accel_scale, accel_scale_map, incli_scale, incli_scale_map, freq_table, f... Message-ID: <20220801164843.00006228@huawei.com> In-Reply-To: <202207241857.Z2woeEfC-lkp@intel.com> References: <202207241857.Z2woeEfC-lkp@intel.com> X-Mailer: Claws Mail 4.0.0 (GTK+ 3.24.29; i686-w64-mingw32) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.202.226.42] X-ClientProxiedBy: lhreml737-chm.china.huawei.com (10.201.108.187) To lhrpeml500005.china.huawei.com (7.191.163.240) X-CFilter-Loop: Reflected ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf02.hostedemail.com: domain of jonathan.cameron@huawei.com designates 185.176.79.56 as permitted sender) smtp.mailfrom=jonathan.cameron@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1659368929; a=rsa-sha256; cv=none; b=DQZmf2Xva+yD7jGhSL4p3EPCxLgoJ7UBAWFEvq49WboO9xqh04ra+t5jYScS1cu57iiRD/ pVLv9lUj4P6LQwFR3s5U81J8JZQwVFYAOaZfopYQzP0E58NYgFwvLH2jqcyY2XWJ1hLBEu +A6fZOcn+kqOQVEsR2ZfIQAgjjO5MDs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1659368929; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Q/0vFmLmVuIzhyvxr9MipXuDWZAGy2O8zd2h6oQU4Tg=; b=zdQuxsmrEgbgPtB1yvI0yTt5UPV2gURe40hWkFTgYqaFlD5QrvLimXJUeTgMNdcr39CuzV 1yDVwkJdmc4o9CGOFYWAcQXAEJ7yzfi9JqeqYLj9b3EaetWMlnGdeEAiOLywCHFORyWI0i 7XE5diENFXrcNc4rrfG9JWsQJ7MwJ+M= X-Stat-Signature: csyt7pzia9guo6jd16cu3y5r395qkk45 X-Rspamd-Queue-Id: 5E49E800EE X-Rspam-User: Authentication-Results: imf02.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf02.hostedemail.com: domain of jonathan.cameron@huawei.com designates 185.176.79.56 as permitted sender) smtp.mailfrom=jonathan.cameron@huawei.com X-Rspamd-Server: rspam04 X-HE-Tag: 1659368928-482784 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Sun, 24 Jul 2022 18:13:47 +0800 kernel test robot wrote: > tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master > head: 18c107a1f120d095404d141dfad8f594bdc44020 > commit: 38d5cd1e7ee0b3e96f39ed3a93cada1c71352c53 [2450/12552] iio: accel: sca3300: Add inclination channels > config: s390-randconfig-c005-20220721 (https://download.01.org/0day-ci/archive/20220724/202207241857.Z2woeEfC-lkp@intel.com/config) > compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 12fbd2d377e396ad61bce56d71c98a1eb1bebfa9) > reproduce (this is a W=1 build): > wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross > chmod +x ~/bin/make.cross > # install s390 cross compiling tool for clang build > # apt-get install binutils-s390x-linux-gnu > # https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=38d5cd1e7ee0b3e96f39ed3a93cada1c71352c53 > git remote add linux-next https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git > git fetch --no-tags linux-next master > git checkout 38d5cd1e7ee0b3e96f39ed3a93cada1c71352c53 > # save the config file > COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=s390 clang-analyzer If there is any way to screen out the Excessive padding messages it would be much appreciated. For the IIO structures that are producing a lot of these, the padding is entirely deliberate and required for correctness (DMA safety). Right now I'm directing all such warnings to the bin but they must be obscuring more useful warnings... Thanks Jonathan > > If you fix the issue, kindly add following tag where applicable > Reported-by: kernel test robot > > clang-analyzer warnings: (new ones prefixed by >>) > for (tile = 0; tile < 8; tile++) { > ^ > drivers/hid/hid-picolcd_fb.c:249:8: note: Assuming field 'force' is 0 > if (!fbdata->force && !picolcd_fb_update_tile( > ^~~~~~~~~~~~~~ > drivers/hid/hid-picolcd_fb.c:249:8: note: Left side of '&&' is true > drivers/hid/hid-picolcd_fb.c:249:27: note: Calling 'picolcd_fb_update_tile' > if (!fbdata->force && !picolcd_fb_update_tile( > ^~~~~~~~~~~~~~~~~~~~~~~ > drivers/hid/hid-picolcd_fb.c:148:6: note: Assuming 'bpp' is equal to 1 > if (bpp == 1) { > ^~~~~~~~ > drivers/hid/hid-picolcd_fb.c:148:2: note: Taking true branch > if (bpp == 1) { > ^ > drivers/hid/hid-picolcd_fb.c:149:3: note: Loop condition is true. Entering loop body > for (b = 7; b >= 0; b--) { > ^ > drivers/hid/hid-picolcd_fb.c:151:9: note: The value 0 is assigned to 'i' > for (i = 0; i < 64; i++) { > ^~~~~ > drivers/hid/hid-picolcd_fb.c:151:4: note: Loop condition is true. Entering loop body > for (i = 0; i < 64; i++) { > ^ > drivers/hid/hid-picolcd_fb.c:152:14: note: The left expression of the compound assignment is an uninitialized value. The computed value will also be garbage > tdata[i] <<= 1; > ~~~~~~~~ ^ > drivers/hid/hid-picolcd_fb.c:160:14: warning: The left expression of the compound assignment is an uninitialized value. The computed value will also be garbage [clang-analyzer-core.uninitialized.Assign] > tdata[i] <<= 1; > ^ > drivers/hid/hid-picolcd_fb.c:438:2: note: Calling 'picolcd_fb_update' > picolcd_fb_update(info); > ^~~~~~~~~~~~~~~~~~~~~~~ > drivers/hid/hid-picolcd_fb.c:234:2: note: Loop condition is false. Exiting loop > spin_lock_irqsave(&fbdata->lock, flags); > ^ > include/linux/spinlock.h:379:2: note: expanded from macro 'spin_lock_irqsave' > raw_spin_lock_irqsave(spinlock_check(lock), flags); \ > ^ > include/linux/spinlock.h:240:2: note: expanded from macro 'raw_spin_lock_irqsave' > do { \ > ^ > drivers/hid/hid-picolcd_fb.c:234:2: note: Loop condition is false. Exiting loop > spin_lock_irqsave(&fbdata->lock, flags); > ^ > include/linux/spinlock.h:377:43: note: expanded from macro 'spin_lock_irqsave' > #define spin_lock_irqsave(lock, flags) \ > ^ > drivers/hid/hid-picolcd_fb.c:235:6: note: Assuming field 'ready' is not equal to 0 > if (!fbdata->ready && fbdata->picolcd) > ^~~~~~~~~~~~~~ > drivers/hid/hid-picolcd_fb.c:235:21: note: Left side of '&&' is false > if (!fbdata->ready && fbdata->picolcd) > ^ > drivers/hid/hid-picolcd_fb.c:247:2: note: Loop condition is true. Entering loop body > for (chip = 0; chip < 4; chip++) > ^ > drivers/hid/hid-picolcd_fb.c:248:3: note: Loop condition is true. Entering loop body > for (tile = 0; tile < 8; tile++) { > ^ > drivers/hid/hid-picolcd_fb.c:249:8: note: Assuming field 'force' is 0 > if (!fbdata->force && !picolcd_fb_update_tile( > ^~~~~~~~~~~~~~ > drivers/hid/hid-picolcd_fb.c:249:8: note: Left side of '&&' is true > drivers/hid/hid-picolcd_fb.c:249:27: note: Calling 'picolcd_fb_update_tile' > if (!fbdata->force && !picolcd_fb_update_tile( > ^~~~~~~~~~~~~~~~~~~~~~~ > drivers/hid/hid-picolcd_fb.c:148:6: note: Assuming 'bpp' is not equal to 1 > if (bpp == 1) { > ^~~~~~~~ > drivers/hid/hid-picolcd_fb.c:148:2: note: Taking false branch > if (bpp == 1) { > ^ > drivers/hid/hid-picolcd_fb.c:156:13: note: Assuming 'bpp' is equal to 8 > } else if (bpp == 8) { > ^~~~~~~~ > drivers/hid/hid-picolcd_fb.c:156:9: note: Taking true branch > } else if (bpp == 8) { > ^ > drivers/hid/hid-picolcd_fb.c:157:3: note: Loop condition is true. Entering loop body > for (b = 7; b >= 0; b--) { > ^ > drivers/hid/hid-picolcd_fb.c:159:9: note: The value 0 is assigned to 'i' > for (i = 0; i < 64; i++) { > ^~~~~ > drivers/hid/hid-picolcd_fb.c:159:4: note: Loop condition is true. Entering loop body > for (i = 0; i < 64; i++) { > ^ > drivers/hid/hid-picolcd_fb.c:160:14: note: The left expression of the compound assignment is an uninitialized value. The computed value will also be garbage > tdata[i] <<= 1; > ~~~~~~~~ ^ > drivers/hid/hid-picolcd_fb.c:481:6: warning: Call to function 'sscanf' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'sscanf_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling] > i = sscanf(buf, "%u", &u); > ^~~~~~ > drivers/hid/hid-picolcd_fb.c:481:6: note: Call to function 'sscanf' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'sscanf_s' in case of C11 > i = sscanf(buf, "%u", &u); > ^~~~~~ > Suppressed 22 warnings (10 in non-user code, 12 with check filters). > Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. > 24 warnings generated. > >> drivers/iio/accel/sca3300.c:162:8: warning: Excessive padding in 'struct sca3300_chip_info' (17 padding bytes, where 1 is optimal). Optimal fields order: name, scan_masks, channels, accel_scale, accel_scale_map, incli_scale, incli_scale_map, freq_table, freq_map, avail_modes_table, num_channels, num_accel_scales, num_incli_scales, num_freqs, num_avail_modes, chip_id, angle_supported, consider reordering the fields or adding explicit padding members [clang-analyzer-optin.performance.Padding] > struct sca3300_chip_info { > ~~~~~~~^~~~~~~~~~~~~~~~~~~ > drivers/iio/accel/sca3300.c:162:8: note: Excessive padding in 'struct sca3300_chip_info' (17 padding bytes, where 1 is optimal). Optimal fields order: name, scan_masks, channels, accel_scale, accel_scale_map, incli_scale, incli_scale_map, freq_table, freq_map, avail_modes_table, num_channels, num_accel_scales, num_incli_scales, num_freqs, num_avail_modes, chip_id, angle_supported, consider reordering the fields or adding explicit padding members > struct sca3300_chip_info { > ~~~~~~~^~~~~~~~~~~~~~~~~~~ > drivers/iio/accel/sca3300.c:191:8: warning: Excessive padding in 'struct sca3300_data' (328 padding bytes, where 72 is optimal). Optimal fields order: txbuf, rxbuf, spi, chip, scan, lock, consider reordering the fields or adding explicit padding members [clang-analyzer-optin.performance.Padding] > struct sca3300_data { > ~~~~~~~^~~~~~~~~~~~~~ > drivers/iio/accel/sca3300.c:191:8: note: Excessive padding in 'struct sca3300_data' (328 padding bytes, where 72 is optimal). Optimal fields order: txbuf, rxbuf, spi, chip, scan, lock, consider reordering the fields or adding explicit padding members > struct sca3300_data { > ~~~~~~~^~~~~~~~~~~~~~ > Suppressed 22 warnings (10 in non-user code, 12 with check filters). > Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. > 22 warnings generated. > Suppressed 22 warnings (9 in non-user code, 13 with check filters). > Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. > 23 warnings generated. > Suppressed 23 warnings (11 in non-user code, 12 with check filters). > Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. > 22 warnings generated. > Suppressed 22 warnings (10 in non-user code, 12 with check filters). > Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. > 22 warnings generated. > Suppressed 22 warnings (10 in non-user code, 12 with check filters). > Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. > 22 warnings generated. > Suppressed 22 warnings (10 in non-user code, 12 with check filters). > Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. > 12 warnings generated. > drivers/hwmon/emc6w201.c:186:9: warning: Call to function 'sprintf' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'sprintf_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling] > return sprintf(buf, "%u\n", > ^~~~~~~ > drivers/hwmon/emc6w201.c:186:9: note: Call to function 'sprintf' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'sprintf_s' in case of C11 > return sprintf(buf, "%u\n", > ^~~~~~~ > drivers/hwmon/emc6w201.c:225:9: warning: Call to function 'sprintf' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'sprintf_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling] > return sprintf(buf, "%d\n", (int)data->temp[sf][nr] * 1000); > ^~~~~~~ > drivers/hwmon/emc6w201.c:225:9: note: Call to function 'sprintf' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'sprintf_s' in case of C11 > return sprintf(buf, "%d\n", (int)data->temp[sf][nr] * 1000); > ^~~~~~~ > drivers/hwmon/emc6w201.c:270:9: warning: Call to function 'sprintf' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'sprintf_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling] > return sprintf(buf, "%u\n", rpm); > ^~~~~~~ > drivers/hwmon/emc6w201.c:270:9: note: Call to function 'sprintf' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'sprintf_s' in case of C11 > return sprintf(buf, "%u\n", rpm); > ^~~~~~~ > Suppressed 9 warnings (9 in non-user code). > Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. > 55 warnings generated. > drivers/hwmon/f71882fg.c:1382:9: warning: Call to function 'sprintf' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'sprintf_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling] > return sprintf(buf, "%d\n", speed); > ^~~~~~~ > drivers/hwmon/f71882fg.c:1382:9: note: Call to function 'sprintf' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'sprintf_s' in case of C11 > return sprintf(buf, "%d\n", speed); > ^~~~~~~ > drivers/hwmon/f71882fg.c:1391:9: warning: Call to function 'sprintf' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'sprintf_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling] > return sprintf(buf, "%d\n", speed); > ^~~~~~~ > drivers/hwmon/f71882fg.c:1391:9: note: Call to function 'sprintf' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'sprintf_s' in case of C11 > return sprintf(buf, "%d\n", speed); > ^~~~~~~ > drivers/hwmon/f71882fg.c:1424:10: warning: Call to function 'sprintf' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'sprintf_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling] > return sprintf(buf, "1\n"); > ^~~~~~~ > drivers/hwmon/f71882fg.c:1424:10: note: Call to function 'sprintf' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'sprintf_s' in case of C11 > return sprintf(buf, "1\n"); > ^~~~~~~ > drivers/hwmon/f71882fg.c:1426:10: warning: Call to function 'sprintf' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'sprintf_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling] > return sprintf(buf, "0\n"); > ^~~~~~~ > drivers/hwmon/f71882fg.c:1426:10: note: Call to function 'sprintf' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'sprintf_s' in case of C11 > return sprintf(buf, "0\n"); > ^~~~~~~ > drivers/hwmon/f71882fg.c:1460:10: warning: Call to function 'sprintf' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'sprintf_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling] > return sprintf(buf, "1\n"); > ^~~~~~~ > drivers/hwmon/f71882fg.c:1460:10: note: Call to function 'sprintf' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'sprintf_s' in case of C11 > return sprintf(buf, "1\n"); > ^~~~~~~ > drivers/hwmon/f71882fg.c:1462:10: warning: Call to function 'sprintf' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'sprintf_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling] > return sprintf(buf, "0\n"); > ^~~~~~~ > drivers/hwmon/f71882fg.c:1462:10: note: Call to function 'sprintf' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'sprintf_s' in case of C11 > return sprintf(buf, "0\n"); > ^~~~~~~ > drivers/hwmon/f71882fg.c:1471:9: warning: Call to function 'sprintf' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'sprintf_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling] > return sprintf(buf, "%d\n", data->in[nr] * 8); > ^~~~~~~ > drivers/hwmon/f71882fg.c:1471:9: note: Call to function 'sprintf' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'sprintf_s' in case of C11 > return sprintf(buf, "%d\n", data->in[nr] * 8); > ^~~~~~~ > drivers/hwmon/f71882fg.c:1479:9: warning: Call to function 'sprintf' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'sprintf_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling] > return sprintf(buf, "%d\n", data->in1_max * 8); > ^~~~~~~ > drivers/hwmon/f71882fg.c:1479:9: note: Call to function 'sprintf' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'sprintf_s' in case of C11 > return sprintf(buf, "%d\n", data->in1_max * 8); > ^~~~~~~ > drivers/hwmon/f71882fg.c:1514:10: warning: Call to function 'sprintf' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'sprintf_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling] > return sprintf(buf, "1\n"); > > vim +162 drivers/iio/accel/sca3300.c > > 38d5cd1e7ee0b3 LI Qingwu 2022-05-29 161 > ad985d4d38d7ad LI Qingwu 2022-05-29 @162 struct sca3300_chip_info { > ad985d4d38d7ad LI Qingwu 2022-05-29 163 const char *name; > ad985d4d38d7ad LI Qingwu 2022-05-29 164 const unsigned long *scan_masks; > ad985d4d38d7ad LI Qingwu 2022-05-29 165 const struct iio_chan_spec *channels; > ad985d4d38d7ad LI Qingwu 2022-05-29 166 u8 num_channels; > ad985d4d38d7ad LI Qingwu 2022-05-29 167 u8 num_accel_scales; > ad985d4d38d7ad LI Qingwu 2022-05-29 168 const int (*accel_scale)[2]; > ad985d4d38d7ad LI Qingwu 2022-05-29 169 const int *accel_scale_map; > 38d5cd1e7ee0b3 LI Qingwu 2022-05-29 170 const int (*incli_scale)[2]; > 38d5cd1e7ee0b3 LI Qingwu 2022-05-29 171 const int *incli_scale_map; > 38d5cd1e7ee0b3 LI Qingwu 2022-05-29 172 u8 num_incli_scales; > ad985d4d38d7ad LI Qingwu 2022-05-29 173 u8 num_freqs; > ad985d4d38d7ad LI Qingwu 2022-05-29 174 const int *freq_table; > ad985d4d38d7ad LI Qingwu 2022-05-29 175 const int *freq_map; > ad985d4d38d7ad LI Qingwu 2022-05-29 176 const int *avail_modes_table; > ad985d4d38d7ad LI Qingwu 2022-05-29 177 u8 num_avail_modes; > ad985d4d38d7ad LI Qingwu 2022-05-29 178 u8 chip_id; > 38d5cd1e7ee0b3 LI Qingwu 2022-05-29 179 bool angle_supported; > ad985d4d38d7ad LI Qingwu 2022-05-29 180 }; > ad985d4d38d7ad LI Qingwu 2022-05-29 181 > > :::::: The code at line 162 was first introduced by commit > :::::: ad985d4d38d7ad8a83b0ff428ea51a2f41ce12e1 iio: accel: sca3300: modified to support multi chips > > :::::: TO: LI Qingwu > :::::: CC: Jonathan Cameron >