From: Dan Carpenter <dan.carpenter@linaro.org>
To: Guenter Roeck <linux@roeck-us.net>
Cc: Su Hui <suhui@nfschina.com>, Jeremy Kerr <jk@ozlabs.org>,
Joel Stanley <joel@jms.id.au>,
Alistar Popple <alistair@popple.id.au>,
Eddie James <eajames@linux.ibm.com>,
eajames@us.ibm.com, kernel-janitors@vger.kernel.org,
linux-kernel@vger.kernel.org, cbostic@linux.vnet.ibm.com,
linux-fsi@lists.ozlabs.org
Subject: Re: [PATCH] drivers/fsi/scom: Return -EFAULT if copy fails
Date: Tue, 23 May 2023 10:05:45 +0300 [thread overview]
Message-ID: <413f4e50-b722-427f-ab30-d320efe71cc0@kili.mountain> (raw)
In-Reply-To: <de9a7ffe-bedd-4181-886d-c9a3006b7be8@roeck-us.net>
On Mon, May 22, 2023 at 03:30:06PM -0700, Guenter Roeck wrote:
> On Fri, May 19, 2023 at 09:37:10AM +0800, Su Hui wrote:
> > The copy_to/from_user() functions return the number of bytes remaining
> > to be copied, but we want to return -EFAULT to the user.
> >
> Why ? EFAULT means that a bad address was provided, and it is not
> immediately obvious why that would be the case.
>
Right now the function is returning success so that's definitely wrong.
The copy_to/from_user() function will only fail if a bad address is
provided so -EFAULT is correct.
There is a different Smatch warning for when people return a different
error code such as -EINVAL.
drivers/fsi/fsi-scom.c:337 scom_read() warn: return -EFAULT instead of '-EINVAL'
The return affects the user and -EFAULT but that level of pendantry feel
like possibly too much? There aren't many instances of this warning.
regards,
dan carpenter
prev parent reply other threads:[~2023-05-23 7:06 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-19 1:37 Su Hui
2023-05-22 22:30 ` Guenter Roeck
2023-05-23 4:32 ` Longsuhui
2023-05-23 7:05 ` Dan Carpenter [this message]
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=413f4e50-b722-427f-ab30-d320efe71cc0@kili.mountain \
--to=dan.carpenter@linaro.org \
--cc=alistair@popple.id.au \
--cc=cbostic@linux.vnet.ibm.com \
--cc=eajames@linux.ibm.com \
--cc=eajames@us.ibm.com \
--cc=jk@ozlabs.org \
--cc=joel@jms.id.au \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-fsi@lists.ozlabs.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=suhui@nfschina.com \
/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®