* [PATCH 2/2] staging: replace simple_strtoul with kstroul
@ 2015-02-19 22:13 Ameen Ali
2015-02-20 22:32 ` Andrew Morton
0 siblings, 1 reply; 2+ messages in thread
From: Ameen Ali @ 2015-02-19 22:13 UTC (permalink / raw)
To: akpm; +Cc: linux-kernel, Ameen Ali, Ameen Ali
Replacing obsolete simple_stroul with kstroul
Signed-off-by: Ameen Ali <Ameenali023@gmail.com>
---
kernel/printk/printk.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
index c06df7d..058302c 100644
--- a/kernel/printk/printk.c
+++ b/kernel/printk/printk.c
@@ -518,7 +518,7 @@ struct devkmsg_user {
static ssize_t devkmsg_write(struct kiocb *iocb, struct iov_iter *from)
{
char *buf, *line;
- int i;
+ unsigned long int i;
int level = default_message_loglevel;
int facility = 1; /* LOG_USER */
size_t len = iocb->ki_nbytes;
@@ -549,7 +549,7 @@ static ssize_t devkmsg_write(struct kiocb *iocb, struct iov_iter *from)
if (line[0] == '<') {
char *endp = NULL;
- i = simple_strtoul(line+1, &endp, 10);
+ i = kstrtoul(line+1,10, &endp);
if (endp && endp[0] == '>') {
level = i & 7;
if (i >> 3)
--
2.1.0
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH 2/2] staging: replace simple_strtoul with kstroul
2015-02-19 22:13 [PATCH 2/2] staging: replace simple_strtoul with kstroul Ameen Ali
@ 2015-02-20 22:32 ` Andrew Morton
0 siblings, 0 replies; 2+ messages in thread
From: Andrew Morton @ 2015-02-20 22:32 UTC (permalink / raw)
To: Ameen Ali; +Cc: linux-kernel, Ameen Ali
On Fri, 20 Feb 2015 00:13:57 +0200 Ameen Ali <ameenali023@gmail.com> wrote:
> Subject: [PATCH 2/2] staging: replace simple_strtoul with kstroul
This isn't a staging patch.
s/kstroul/kstrtoul/
> Date: Fri, 20 Feb 2015 00:13:57 +0200
> X-Mailer: git-send-email 2.1.0
>
> Replacing obsolete simple_stroul with kstroul
s/kstroul/kstrtoul/
> --- a/kernel/printk/printk.c
> +++ b/kernel/printk/printk.c
> @@ -518,7 +518,7 @@ struct devkmsg_user {
> static ssize_t devkmsg_write(struct kiocb *iocb, struct iov_iter *from)
> {
> char *buf, *line;
> - int i;
> + unsigned long int i;
It would be better to move this definition so it is local to the `if'
loop where it is used. And to give it a meaningful name - using `i' is lame.
> int level = default_message_loglevel;
> int facility = 1; /* LOG_USER */
> size_t len = iocb->ki_nbytes;
> @@ -549,7 +549,7 @@ static ssize_t devkmsg_write(struct kiocb *iocb, struct iov_iter *from)
> if (line[0] == '<') {
> char *endp = NULL;
>
> - i = simple_strtoul(line+1, &endp, 10);
> + i = kstrtoul(line+1,10, &endp);
> if (endp && endp[0] == '>') {
> level = i & 7;
> if (i >> 3)
The interfaces are different - kstrtoul() can return a negative errno.
afaict we'll only have issues if someone tried to print "<>..", but
this string is coming from userspace so we must be very paranoid.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-02-20 22:32 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-19 22:13 [PATCH 2/2] staging: replace simple_strtoul with kstroul Ameen Ali
2015-02-20 22:32 ` Andrew Morton
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®