lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 29 Jan 2015 22:52:46 +0100
From:	Rickard Strandqvist <rickard_strandqvist@...ctrumdigital.se>
To:	Chris Rorvick <chris@...vick.com>
Cc:	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Vincenzo Scotti <vinc94@...il.com>,
	Roberta Dobrescu <roberta.dobrescu@...il.com>,
	Sachin Kamat <sachin.kamat@...sung.com>,
	Simon Horman <horms+renesas@...ge.net.au>,
	Ebru Akagunduz <ebru.akagunduz@...il.com>,
	Magnus Damm <damm+renesas@...nsource.se>,
	"devel@...verdev.osuosl.org" <devel@...verdev.osuosl.org>,
	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] staging: emxx_udc: emxx_udc: Removed variables that is
 never used

2015-01-29 3:37 GMT+01:00 Chris Rorvick <chris@...vick.com>:
> On Wed, Jan 28, 2015 at 4:42 PM, Rickard Strandqvist
> <rickard_strandqvist@...ctrumdigital.se> wrote:
>> Variable ar assigned a value that is never used.
>> I have also removed all the code that thereby serves no purpose.
>
> Each of these changes adds a warning ...
>
>> diff --git a/drivers/staging/emxx_udc/emxx_udc.c b/drivers/staging/emxx_udc/emxx_udc.c
>> index eb178fc..b916fab 100644
>> --- a/drivers/staging/emxx_udc/emxx_udc.c
>> +++ b/drivers/staging/emxx_udc/emxx_udc.c
>> @@ -2974,10 +2974,10 @@ static int nbu2ss_ep_fifo_status(struct usb_ep *_ep)
>>         spin_lock_irqsave(&udc->lock, flags);
>>
>>         if (ep->epnum == 0) {
>> -               data = _nbu2ss_readl(&preg->EP0_LENGTH) & EP0_LDATA;
>> +               _nbu2ss_readl(&preg->EP0_LENGTH) & EP0_LDATA;
>
> .../linux/drivers/staging/emxx_udc/emxx_udc.c:2977:36: warning: value
> computed is not used [-Wunused-value]
>    _nbu2ss_readl(&preg->EP0_LENGTH) & EP0_LDATA;
>                                     ^
>
>>         } else {
>> -               data = _nbu2ss_readl(&preg->EP_REGS[ep->epnum-1].EP_LEN_DCNT)
>> +               _nbu2ss_readl(&preg->EP_REGS[ep->epnum-1].EP_LEN_DCNT)
>>                         & EPn_LDATA;
>
> .../linux/drivers/staging/emxx_udc/emxx_udc.c:2981:4: warning: value
> computed is not used [-Wunused-value]
>     & EPn_LDATA;
>     ^
>
>>         }
>>
>> @@ -3264,12 +3264,11 @@ static void __init nbu2ss_drv_set_ep_info(
>>         if (isdigit(name[2])) {
>>
>>                 long    num;
>> -               int     res;
>>                 char    tempbuf[2];
>>
>>                 tempbuf[0] = name[2];
>>                 tempbuf[1] = '\0';
>> -               res = kstrtol(tempbuf, 16, &num);
>> +               kstrtol(tempbuf, 16, &num);
>
> .../linux/drivers/staging/emxx_udc/emxx_udc.c:3271:3: warning:
> ignoring return value of ‘kstrtol’, declared with attribute
> warn_unused_result [-Wunused-result]
>    kstrtol(tempbuf, 16, &num);
>    ^

Hi

The first two were my fault, stupid of me to let the "& number" remain :(

The last one was more interesting, se below.
But I can not really see how any error should be handled here?
Proposal to change to:

  if (kstrtol(tempbuf, 16, &num) == 0 && num == 0)


static inline int __must_check kstrtol(const char *s, unsigned int
base, long *res);

"The __must_check annotation makes use of the gcc warn_unused_result
attribute; it first found its way into the mainline in 2.6.8. If a
function is marked __must_check, the compiler will issue a strong
warning whenever the function is called and its return code is unused.
"


Kind regards
Rickard Strandqvist
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ