From: Andrew Morton <akpm@osdl.org>
To: eric.piel@tremplin-utc.net
Cc: minyard@acm.org, george@mvista.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Incorrect value for SIGRTMAX
Date: Sat, 24 Jan 2004 14:30:37 -0800 [thread overview]
Message-ID: <20040124143037.5116ccc9.akpm@osdl.org> (raw)
In-Reply-To: <1074979873.4012e421714b1@mailetu.utc.fr>
eric.piel@tremplin-utc.net wrote:
>
> Hello,
>
> Few months ago, Corey Minyard corrected handling of incorrect values of signals.
> cf
> http://linux.bkbits.net:8080/linux-2.5/cset@1.1267.56.40?nav=index.html%7Csrc/%7Csrc/kernel%7Crelated/kernel/posix-timers.c
>
> Working on the High-Resolution Timers project, I noticed there is an error in
> good_sigevent() to catch the case when sigev_signo is 0. In this function, we
> want to return NULL when sigev_signo is 0. The one liner attached (used for a
> long time in the HRT patch) should do the trick, it's against vanilla 2.6.1 .
>
OK, the current code is obviously junk:
if ((event->sigev_notify & ~SIGEV_NONE & MIPS_SIGEV) &&
event->sigev_signo &&
((unsigned) (event->sigev_signo > SIGRTMAX)))
return NULL;
a) it's doing
if (foo && foo > N)
which is redundant.
b) it's casting the result of (foo > N) to unsigned which is nonsensical.
Your patch doesn't address b).
I don't thik there's a case in which sigev_signo can be negative anyway.
But if there is, the cast should be done like the below, yes?
kernel/posix-timers.c | 3 +--
1 files changed, 1 insertion(+), 2 deletions(-)
diff -puN kernel/posix-timers.c~SIGRTMAX-fix kernel/posix-timers.c
--- 25/kernel/posix-timers.c~SIGRTMAX-fix 2004-01-24 14:27:13.000000000 -0800
+++ 25-akpm/kernel/posix-timers.c 2004-01-24 14:28:21.000000000 -0800
@@ -344,8 +344,7 @@ static inline struct task_struct * good_
return NULL;
if ((event->sigev_notify & ~SIGEV_NONE & MIPS_SIGEV) &&
- event->sigev_signo &&
- ((unsigned) (event->sigev_signo > SIGRTMAX)))
+ (((unsigned)event->sigev_signo > SIGRTMAX) || !event->sigev_signo))
return NULL;
return rtn;
_
next prev parent reply other threads:[~2004-01-24 22:31 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-01-24 21:31 eric.piel
2004-01-24 22:30 ` Andrew Morton [this message]
2004-01-24 22:37 ` eric.piel
2004-01-25 9:21 ` George Anzinger
2004-01-25 10:28 ` eric.piel
2004-01-27 9:19 ` [PATCH] Incorrect value for SIGRTMAX, MIPS nonsense removed, timer_gettime fix George Anzinger
2004-01-27 18:46 ` Andrew Morton
2004-01-27 20:32 ` George Anzinger
2004-01-27 9:31 ` [PATCH] Fine tune the time conversion to eliminate conversion errors George Anzinger
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=20040124143037.5116ccc9.akpm@osdl.org \
--to=akpm@osdl.org \
--cc=eric.piel@tremplin-utc.net \
--cc=george@mvista.com \
--cc=linux-kernel@vger.kernel.org \
--cc=minyard@acm.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®