From: Greg KH <gregkh@linuxfoundation.org>
To: Tony Cho <tony.cho@atmel.com>
Cc: devel@driverdev.osuosl.org, rachel.kim@atmel.com,
chris.park@atmel.com, austin.shin@atmel.com,
linux-wireless@vger.kernel.org, johnny.kim@atmel.com,
Nicolas.FERRE@atmel.com, adel.noureldin@atmel.com,
leo.kim@atmel.com, adham.abozaeid@atmel.com
Subject: Re: [PATCH v2 1/4] staging: wilc1000: fix null check routine
Date: Fri, 18 Sep 2015 19:50:38 -0700 [thread overview]
Message-ID: <20150919025038.GA2889@kroah.com> (raw)
In-Reply-To: <1442484140-13485-2-git-send-email-tony.cho@atmel.com>
On Thu, Sep 17, 2015 at 07:02:17PM +0900, Tony Cho wrote:
> From: Leo Kim <leo.kim@atmel.com>
>
> This patch removes the potential faults which may happen when unexpectedly
> getting access to invalid pointer. The pointer of pstrWFIDrv is unlikely
> to be invalid. However, it is safer to return error when the invalid
> memory is unfortunately accessed.
>
> Signed-off-by: Leo Kim <leo.kim@atmel.com>
> Signed-off-by: Tony Cho <tony.cho@atmel.com>
> ---
> drivers/staging/wilc1000/host_interface.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
> index 6fdf392..151e8c4 100644
> --- a/drivers/staging/wilc1000/host_interface.c
> +++ b/drivers/staging/wilc1000/host_interface.c
> @@ -2403,8 +2403,10 @@ static s32 Handle_RcvdGnrlAsyncInfo(tstrWILC_WFIDrv *drvHandler, tstrRcvdGnrlAsy
> s32 s32Err = 0;
> tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *) drvHandler;
>
> - if (pstrWFIDrv == NULL)
> + if (unlikely(!pstrWFIDrv)) {
Can you measure the difference of using unlikely and not using it? If
not, never use it, as odds are, the compiler and processor already
guessed it correctly and made the code faster.
If you can measure it, great, I'll be glad to take this patch, but you
need to show your measurements in the changelog comments.
> PRINT_ER("Driver handler is NULL\n");
> + return -EFAULT;
-EFAULT is only for when we take a memory fault, which is not what is
happening here. -ENODEV?
thanks,
greg k-h
next prev parent reply other threads:[~2015-09-19 4:59 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-17 10:02 [PATCH v2 0/4] v2 of the series including the null check routin Tony Cho
2015-09-17 10:02 ` [PATCH v2 1/4] staging: wilc1000: fix null check routine Tony Cho
2015-09-19 2:50 ` Greg KH [this message]
2015-09-21 1:52 ` Tony Cho
2015-09-17 10:02 ` [PATCH v2 2/4] staging: wilc1000: remove warnings on the multiple blank lines uses Tony Cho
2015-09-19 2:52 ` Greg KH
2015-09-17 10:02 ` [PATCH v2 3/4] staging: wilc1000: remove warnings line over 80 characters Tony Cho
2015-09-17 10:02 ` [PATCH v2 4/4] staging: wilc1000: wilc_wlan_if.h align defines Tony Cho
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=20150919025038.GA2889@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=Nicolas.FERRE@atmel.com \
--cc=adel.noureldin@atmel.com \
--cc=adham.abozaeid@atmel.com \
--cc=austin.shin@atmel.com \
--cc=chris.park@atmel.com \
--cc=devel@driverdev.osuosl.org \
--cc=johnny.kim@atmel.com \
--cc=leo.kim@atmel.com \
--cc=linux-wireless@vger.kernel.org \
--cc=rachel.kim@atmel.com \
--cc=tony.cho@atmel.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;
as well as URLs for NNTP newsgroup(s).