From: Dan Carpenter <error27@gmail.com>
To: mark gross <markgross@thegnar.org>
Cc: "Rafael J. Wysocki" <rjw@sisk.pl>,
James Bottomley <James.Bottomley@suse.de>,
Frederic Weisbecker <fweisbec@gmail.com>,
Jonathan Corbet <corbet@lwn.net>,
linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [patch] pm_qos_params: cleanup: terminate a string
Date: Tue, 7 Sep 2010 23:38:18 +0200 [thread overview]
Message-ID: <20100907213818.GA5351@bicker> (raw)
In-Reply-To: <20100907133805.GA20050@gvim.org>
On Tue, Sep 07, 2010 at 06:38:05AM -0700, mark gross wrote:
> > spin_unlock_irqrestore(&pm_qos_lock, flags);
> > @@ -374,10 +374,12 @@ static ssize_t pm_qos_power_write(struct file *filp, const char __user *buf,
> > } else if (count == 11) { /* len('0x12345678/0') */
> > if (copy_from_user(ascii_value, buf, 11))
> > return -EFAULT;
> > + if (strlen(ascii_value) > 10)
> should be !=
>
> > + return -EINVAL;
> > x = sscanf(ascii_value, "%x", &value);
> > if (x != 1)
> > return -EINVAL;
With the original code you could do:
char buf[11]; /* must be 11 chars */
snprintf(buf, sizeof(buf), "0x%x", 42);
write(fd, buf, sizeof(buf));
But the new code is stricter so the number would have to be zero padded.
regards,
dan carpenter
next prev parent reply other threads:[~2010-09-07 21:38 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-03 12:41 [patch] pm_qos_params: cleanup: terminate a string Dan Carpenter
2010-09-07 6:22 ` mark gross
2010-09-07 13:38 ` mark gross
2010-09-07 21:38 ` Dan Carpenter [this message]
2010-09-08 22:13 ` Rafael J. Wysocki
2010-09-09 2:56 ` mark gross
2010-09-09 21:21 ` Rafael J. Wysocki
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=20100907213818.GA5351@bicker \
--to=error27@gmail.com \
--cc=James.Bottomley@suse.de \
--cc=corbet@lwn.net \
--cc=fweisbec@gmail.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=markgross@thegnar.org \
--cc=rjw@sisk.pl \
/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