From: Ashish Mhetre <amhetre@nvidia.com>
To: Krzysztof Kozlowski <krzk@kernel.org>, kernel test robot <lkp@intel.com>
Cc: oe-kbuild-all@lists.linux.dev, linux-kernel@vger.kernel.org,
Dmitry Osipenko <dmitry.osipenko@collabora.com>,
Thierry Reding <treding@nvidia.com>
Subject: Re: drivers/memory/tegra/tegra186.c:74:49: warning: '%u' directive output may be truncated writing between 1 and 10 bytes into a region of size 6
Date: Wed, 25 Oct 2023 11:54:54 +0530 [thread overview]
Message-ID: <a97fb789-ce3f-44bc-ab0c-797d18cd2cc3@nvidia.com> (raw)
In-Reply-To: <1046b929-8eb6-43bc-9660-a5a1a43916d8@kernel.org>
On 10/19/2023 7:06 PM, Krzysztof Kozlowski wrote:
> External email: Use caution opening links or attachments
>
>
> On 18/10/2023 14:32, kernel test robot wrote:
>> tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
>> head: 06dc10eae55b5ceabfef287a7e5f16ceea204aa0
>> commit: a7cffa11fa9232eabf0c4f441dc53002978ab526 memory: tegra: Add memory controller channels support
>> date: 1 year, 5 months ago
>> config: arm64-randconfig-r036-20230512 (https://download.01.org/0day-ci/archive/20231018/202310182004.0XOYolzI-lkp@intel.com/config)
>> compiler: aarch64-linux-gcc (GCC) 11.3.0
>> reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231018/202310182004.0XOYolzI-lkp@intel.com/reproduce)
>>
>> If you fix the issue in a separate patch/commit (i.e. not just a new version of
>> the same patch/commit), kindly add following tags
>> | Reported-by: kernel test robot <lkp@intel.com>
>> | Closes: https://lore.kernel.org/oe-kbuild-all/202310182004.0XOYolzI-lkp@intel.com/
>>
>> All warnings (new ones prefixed by >>):
> Ashish,
>
> Are you planning to respond to this?
>
> Best regards,
> Krzysztof
Hi Krzysztof,
The value of mc->soc->num_channels is not more that 16. The number of
characters written in 'name' variable won't be more than 4 which is less
than buffer size of 8 bytes. So, can we ignore this warning?
If not, then I can fix this with a patch to check the return value of
snprintf and compare that with size of buffer 'name'. Something like:
- snprintf(name, sizeof(name), "ch%u", i);
+ int n = snprintf(name, sizeof(name), "ch%u", i);
+
+ if (n < 0) {
+ dev_err(&pdev->dev, "snprintf failed\n");
+ return -EFAULT;
+ }
+ if ((size_t)n > sizeof(name)) {
+ dev_err(&pdev->dev, "snprintf output is
truncated\n");
+ return -EFAULT;
+ }
Thanks,
Ashish Mhetre
prev parent reply other threads:[~2023-10-25 6:25 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-18 12:32 kernel test robot
2023-10-19 13:36 ` Krzysztof Kozlowski
2023-10-25 6:24 ` Ashish Mhetre [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=a97fb789-ce3f-44bc-ab0c-797d18cd2cc3@nvidia.com \
--to=amhetre@nvidia.com \
--cc=dmitry.osipenko@collabora.com \
--cc=krzk@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lkp@intel.com \
--cc=oe-kbuild-all@lists.linux.dev \
--cc=treding@nvidia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®