lkml.org 
[lkml]   [2004]   [Oct]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH][resend] small binfmt_elf warning fix (copy_from_user return value checking) (fwd)
On Sun, 24 Oct 2004, Andrew Morton wrote:

> Jesper Juhl <juhl-lkml@dif.dk> wrote:
> >
> > diff -up linux-2.6.9-rc3-bk5-orig/fs/binfmt_elf.c linux-2.6.9-rc3-bk5/fs/binfmt_elf.c
> > --- linux-2.6.9-rc3-bk5-orig/fs/binfmt_elf.c 2004-09-30 05:04:32.000000000 +0200
> > +++ linux-2.6.9-rc3-bk5/fs/binfmt_elf.c 2004-10-06 23:21:22.000000000 +0200
> > @@ -1223,7 +1223,7 @@ static void fill_psinfo(struct elf_prpsi
> > len = mm->arg_end - mm->arg_start;
> > if (len >= ELF_PRARGSZ)
> > len = ELF_PRARGSZ-1;
> > - copy_from_user(&psinfo->pr_psargs,
> > + len -= copy_from_user(&psinfo->pr_psargs,
> > (const char __user *)mm->arg_start, len);
> > for(i = 0; i < len; i++)
> > if (psinfo->pr_psargs[i] == 0)
>
> It doesn't matter, really - we've already zeroed out the memory and will
> correctly handle any uncopied data.
>
Yes, I know, it's mainly to shut up the warning in some resonable way. We
may be saving a few loop iterations, but we'll be adding a subtraction, so
performance wise it probably won't make any difference - but it's a very
cold code path as far as I can see, so it matters little.

> Maybe sticking a (void) in front of the copy_from_user() call will shut the
> warning up. Although it could possibly break the build, depending on how
> the architecture implements copy_from_user().
>
Then isn't my way of shutting up gcc more sensible? little to no impact on
the code and we get rid of the annoying warning in a safe way that won't
break anything.

I'll prepare patches against a recent Linus kernel for the other things in
binfmt_elf I have lying here and submit those shortly, those should fix
more real issues - I hope you won't mind if I also send those your way.

Thank you very much for taking a look.


--
Jesper Juhl


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 14:07    [W:1.630 / U:0.068 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site