lkml.org 
[lkml]   [2018]   [May]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 8/8] signal: simplify rt_sigaction()
On Mon, May 28, 2018 at 11:47:19PM -0700, Christoph Hellwig wrote:
> > + if (act)
> > if (copy_from_user(&new_sa.sa, act, sizeof(new_sa.sa)))
> > return -EFAULT;
>
> if (act && copy_from_user(&new_sa.sa, act, sizeof(new_sa.sa)))
> return -EFAULT;

Yes, I agree and should have been bolder in making that change. But I
already wasn't sure how ok people would be with:

if (act) {} --> if (act)

>
> > ret = do_sigaction(sig, act ? &new_sa : NULL, oact ? &old_sa : NULL);
> > -
> > - if (!ret && oact) {
> > + if (!ret && oact)
> > if (copy_to_user(oact, &old_sa.sa, sizeof(old_sa.sa)))
> > return -EFAULT;
> > - }
>
> ret = do_sigaction(sig, act ? &new_sa : NULL, oact ? &old_sa : NULL);
> if (!ret && oact && copy_to_user(oact, &old_sa.sa, sizeof(old_sa.sa)))
> return -EFAULT;
>
> Althought I'd personaly write it as:
>
> ret = do_sigaction(sig, act ? &new_sa : NULL, oact ? &old_sa : NULL);
> if (ret)
> return ret;
> if (oact && copy_to_user(oact, &old_sa.sa, sizeof(old_sa.sa)))
> return -EFAULT;
> return 0;

Yeah, I can put that in v2.
I'd wait for a little until people have commmented/acked some of the
other changes so that I don't keep spamming inboxes. If you have a few
spare minutes it would be cool if you could take a quick look. It
shouldn't take long.

Thanks!
Christian

\
 
 \ /
  Last update: 2018-05-29 12:25    [W:0.038 / U:4.220 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site