public inbox for devicetree@vger.kernel.org
 help / color / mirror / Atom feed
From: Sumit Gupta <sumitg@nvidia.com>
To: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>,
	<robh@kernel.org>, <conor+dt@kernel.org>, <maz@kernel.org>,
	<mark.rutland@arm.com>, <treding@nvidia.com>,
	<jonathanh@nvidia.com>
Cc: <devicetree@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<linux-tegra@vger.kernel.org>, <amhetre@nvidia.com>,
	<bbasu@nvidia.com>, Sumit Gupta <sumitg@nvidia.com>
Subject: Re: [Patch v3 2/2] memory: tegra: make sid and broadcast regions optional
Date: Wed, 24 Apr 2024 01:16:44 +0530	[thread overview]
Message-ID: <e1d4e915-08c9-c2e0-f882-6d7cd9500c96@nvidia.com> (raw)
In-Reply-To: <6506b2e8-c7f2-460d-b17d-55b731fac1ac@linaro.org>




>>>>
>>>>    static inline u32 mc_readl(const struct tegra_mc *mc, unsigned long offset)
>>>> diff --git a/drivers/memory/tegra/tegra186.c b/drivers/memory/tegra/tegra186.c
>>>> index 1b3183951bfe..716582255eeb 100644
>>>> --- a/drivers/memory/tegra/tegra186.c
>>>> +++ b/drivers/memory/tegra/tegra186.c
>>>> @@ -26,20 +26,16 @@
>>>>    static int tegra186_mc_probe(struct tegra_mc *mc)
>>>>    {
>>>>         struct platform_device *pdev = to_platform_device(mc->dev);
>>>> +     struct resource *res;
>>>>         unsigned int i;
>>>> -     char name[8];
>>>> +     char name[14];
>>>
>>> How is it relevant? I don't see this being used in your diff.
>>>
>>>
>>> Best regards,
>>> Krzysztof
>>>
>>
>> Did this change for below warning coming with 'W=1'.
>>
>> ../drivers/memory/tegra/tegra186.c: In function tegra186_mc_probe:
>> ../drivers/memory/tegra/tegra186.c:51:49: warning: %u directive output
>> may be truncated writing between 1 and 10 bytes into a region of size 6
>> [8;;https://gc
>> c.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wformat-truncation=-Wformat-truncation=8;;]
>>      51 |                 snprintf(name, sizeof(name), "ch%u", i);
>>         |                                                 ^~
>> ../drivers/memory/tegra/tegra186.c:51:46: note: directive argument in
>> the range [0, 4294967294]
>>      51 |                 snprintf(name, sizeof(name), "ch%u", i);
>>         |                                              ^~~~~~
>> ../drivers/memory/tegra/tegra186.c:51:17: note: snprintf output between
>> 4 and 13 bytes into a destination of size 8
>>      51 |                 snprintf(name, sizeof(name), "ch%u", i);
>>         |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 
> I asked how this is relevant to this change and you answer there is a
> warning. If the warning was there, your answer is really just deflecting
> the topic, so obviously this is new warning. Which part of code uses
> longer name?
> 
> BTW, really, such answers do not make review of your code smoother.
> 
> Best regards,
> Krzysztof
> 

Apologies for not explaining it earlier.

I increased the buffer size to suppress a static check warning in the
existing code due to big range of 'unsigned int i', if copied to small
name buffer.

Seems like the warning is harmless as the maximum value of num_channels
is 16. I will remove it and keep the buffer size as 8 in the next
version.

Thank you,
Sumit Gupta

  reply	other threads:[~2024-04-23 19:47 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-12 13:05 [Patch v3 0/2] memory: tegra: Skip restricted register access from Guest Sumit Gupta
2024-04-12 13:05 ` [Patch v3 1/2] dt-bindings: make sid and broadcast reg optional Sumit Gupta
2024-04-22  7:02   ` Krzysztof Kozlowski
2024-04-24 16:26     ` Thierry Reding
2024-04-24 17:04       ` Thierry Reding
2024-04-25  7:52         ` Krzysztof Kozlowski
2024-04-25  9:39           ` Thierry Reding
2024-04-25  9:45             ` Krzysztof Kozlowski
2024-04-25 15:03               ` Thierry Reding
2024-04-25 15:16                 ` Krzysztof Kozlowski
2024-04-25 15:51                   ` Thierry Reding
2024-04-25  7:51       ` Krzysztof Kozlowski
2024-04-25  7:52   ` Krzysztof Kozlowski
2024-04-12 13:05 ` [Patch v3 2/2] memory: tegra: make sid and broadcast regions optional Sumit Gupta
2024-04-22  7:12   ` Krzysztof Kozlowski
2024-04-22 14:36     ` Sumit Gupta
2024-04-23 14:41       ` Krzysztof Kozlowski
2024-04-23 19:46         ` Sumit Gupta [this message]
2024-04-24  4:09           ` Krzysztof Kozlowski
2024-04-24  5:27             ` Sumit Gupta
2024-04-24  5:44               ` Krzysztof Kozlowski
2024-04-24  6:27                 ` Sumit Gupta

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=e1d4e915-08c9-c2e0-f882-6d7cd9500c96@nvidia.com \
    --to=sumitg@nvidia.com \
    --cc=amhetre@nvidia.com \
    --cc=bbasu@nvidia.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=jonathanh@nvidia.com \
    --cc=krzysztof.kozlowski@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=maz@kernel.org \
    --cc=robh@kernel.org \
    --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