mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dhruva Gole <d-gole@ti.com>
To: Viresh Kumar <viresh.kumar@linaro.org>,
	Viresh Kumar <vireshk@kernel.org>, Nishanth Menon <nm@ti.com>,
	Stephen Boyd <sboyd@kernel.org>
Cc: <linux-pm@vger.kernel.org>,
	Vincent Guittot <vincent.guittot@linaro.org>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	kernel test robot <lkp@intel.com>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2/2] OPP: debugfs: Fix warning around icc_get_name()
Date: Mon, 4 Mar 2024 17:22:49 +0530	[thread overview]
Message-ID: <f2dbd3ea-233a-4ce9-a483-92397462f87f@ti.com> (raw)
In-Reply-To: <0275dc46489419f34765c6ed389c0e9d6245fd31.1709551295.git.viresh.kumar@linaro.org>

Hi,

On 04/03/24 16:52, Viresh Kumar wrote:
> If the kernel isn't built with interconnect support, icc_get_name()
> returns NULL and we get following warning:
> 
> drivers/opp/debugfs.c: In function 'bw_name_read':
> drivers/opp/debugfs.c:43:42: error: '%.62s' directive argument is null [-Werror=format-overflow=]
>           i = scnprintf(buf, sizeof(buf), "%.62s\n", icc_get_name(path));
> 
> Fix it.
> 
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202402141313.81ltVF5g-lkp@intel.com/
> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
> ---

Do we not need this:

Fixes: 0430b1d5704b0 ("opp: Expose bandwidth information via debugfs")

?

>   drivers/opp/debugfs.c | 6 ++++--
>   1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/opp/debugfs.c b/drivers/opp/debugfs.c
> index 27c3748347af..a9ebfdf0b6a1 100644
> --- a/drivers/opp/debugfs.c
> +++ b/drivers/opp/debugfs.c
> @@ -37,10 +37,12 @@ static ssize_t bw_name_read(struct file *fp, char __user *userbuf,
>   			    size_t count, loff_t *ppos)
>   {
>   	struct icc_path *path = fp->private_data;
> +	const char *name = icc_get_name(path);
>   	char buf[64];
> -	int i;
> +	int i = 0;
>   
> -	i = scnprintf(buf, sizeof(buf), "%.62s\n", icc_get_name(path));
> +	if (name)
> +		i = scnprintf(buf, sizeof(buf), "%.62s\n", name);

Reviewed-by: Dhruva Gole <d-gole@ti.com>

>   
>   	return simple_read_from_buffer(userbuf, count, ppos, buf, i);
>   }

-- 
Thanks and Regards,
Dhruva Gole

  reply	other threads:[~2024-03-04 11:53 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-04 11:22 [PATCH V2 1/2] OPP: debugfs: Fix warning with W=1 builds Viresh Kumar
2024-03-04 11:22 ` [PATCH 2/2] OPP: debugfs: Fix warning around icc_get_name() Viresh Kumar
2024-03-04 11:52   ` Dhruva Gole [this message]
2024-03-04 11:38 ` [PATCH V2 1/2] OPP: debugfs: Fix warning with W=1 builds Dhruva Gole
2024-03-05  6:09   ` Viresh Kumar

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=f2dbd3ea-233a-4ce9-a483-92397462f87f@ti.com \
    --to=d-gole@ti.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=nm@ti.com \
    --cc=rafael@kernel.org \
    --cc=sboyd@kernel.org \
    --cc=vincent.guittot@linaro.org \
    --cc=viresh.kumar@linaro.org \
    --cc=vireshk@kernel.org \
    /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®