mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Christian Marangi <ansuelsmth@gmail.com>
Cc: Christophe JAILLET <christophe.jaillet@wanadoo.fr>,
	MyungJoo Ham <myungjoo.ham@samsung.com>,
	Kyungmin Park <kyungmin.park@samsung.com>,
	Chanwoo Choi <cw00.choi@samsung.com>,
	Jonghwa Lee <jonghwa3.lee@samsung.com>,
	linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org,
	stable@vger.kernel.org
Subject: Re: [RESEND PATCH 1/2] PM / devfreq: Fix buffer overflow in trans_stat_show
Date: Fri, 5 Jan 2024 08:38:45 +0100	[thread overview]
Message-ID: <2024010542-thespian-agreed-ff3d@gregkh> (raw)
In-Reply-To: <659735f1.050a0220.efb5.1c0d@mx.google.com>

On Thu, Jan 04, 2024 at 11:44:54PM +0100, Christian Marangi wrote:
> On Thu, Jan 04, 2024 at 11:19:44PM +0100, Christophe JAILLET wrote:
> > > @@ -1688,7 +1688,7 @@ static ssize_t trans_stat_show(struct device *dev,
> > >   			       struct device_attribute *attr, char *buf)
> > >   {
> > >   	struct devfreq *df = to_devfreq(dev);
> > > -	ssize_t len;
> > > +	ssize_t len = 0;
> > >   	int i, j;
> > >   	unsigned int max_state;
> > > @@ -1697,7 +1697,7 @@ static ssize_t trans_stat_show(struct device *dev,
> > >   	max_state = df->max_state;
> > >   	if (max_state == 0)
> > > -		return sprintf(buf, "Not Supported.\n");
> > > +		return scnprintf(buf, PAGE_SIZE, "Not Supported.\n");
> > 
> > Hi,
> > 
> > maybe using  sysfs_emit_at() could be even cleaner and less verbose?
> >
> 
> If you notice this change is done in the second patch of the series.
> This patch still use this more generic way to permit this to be
> backported on stable kernel. (older kernel doesn't have sysfs_emit_at()
> hence it can't be backported)

All activly supported kernels on the kernel.org front page have
sysfs_emit_at(), so this should not be an issue for anyone.  Just do the
change here at the same time.

thanks,

greg k-h

  reply	other threads:[~2024-01-05  7:38 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-04 21:55 Christian Marangi
2024-01-04 21:55 ` [RESEND PATCH 2/2] PM / devfreq: Convert to use sysfs_emit_at() API Christian Marangi
2024-01-04 22:19 ` [RESEND PATCH 1/2] PM / devfreq: Fix buffer overflow in trans_stat_show Christophe JAILLET
2024-01-04 22:44   ` Christian Marangi
2024-01-05  7:38     ` Greg KH [this message]
2024-01-05  7:52     ` Christophe JAILLET

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=2024010542-thespian-agreed-ff3d@gregkh \
    --to=gregkh@linuxfoundation.org \
    --cc=ansuelsmth@gmail.com \
    --cc=christophe.jaillet@wanadoo.fr \
    --cc=cw00.choi@samsung.com \
    --cc=jonghwa3.lee@samsung.com \
    --cc=kyungmin.park@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=myungjoo.ham@samsung.com \
    --cc=stable@vger.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®