From: Thomas Gleixner <tglx@linutronix.de>
To: Chen Gang <gang.chen@asianux.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] kernel/itimer.c: for return value, using -EINVAL instead of -EFAULT
Date: Thu, 20 Jun 2013 08:59:33 +0200 (CEST) [thread overview]
Message-ID: <alpine.DEB.2.02.1306200847300.4013@ionos.tec.linutronix.de> (raw)
In-Reply-To: <51C29FBC.1090507@asianux.com>
On Thu, 20 Jun 2013, Chen Gang wrote:
> For the system call getitimer(), if the parameter 'value' is NULL, need
> return -EINVAL, not -EFAULT.
Care to explain why? Because you are feeling so?
I recommend reading the man page of getitimer:
ERRORS
EFAULT new_value, old_value, or curr_value is not valid a pointer.
And NULL is definitely NOT a valid pointer.
The Posix spec does not specify an explicit error value for this
syscall, but the general policy is:
[EFAULT]
Bad address. The system detected an invalid address in attempting
to use an argument of a call. The reliable detection of this error
cannot be guaranteed, and when not detected may result in the
generation of a signal, indicating an address violation, which is
sent to the process.
And we made use of this, which is correct and makes sense.
Returning EINVAL makes no sense at all, because EINVAL _IS_ a
specified error code for this syscall:
[EINVAL]
The which argument is not recognized.
Thanks,
tglx
next prev parent reply other threads:[~2013-06-20 6:59 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-20 6:22 Chen Gang
2013-06-20 6:59 ` Thomas Gleixner [this message]
2013-06-20 7:18 ` Chen Gang
2013-06-20 7:44 ` Thomas Gleixner
2013-06-20 8:16 ` Chen Gang
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=alpine.DEB.2.02.1306200847300.4013@ionos.tec.linutronix.de \
--to=tglx@linutronix.de \
--cc=gang.chen@asianux.com \
--cc=linux-kernel@vger.kernel.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®