* [PATCH net] mcs7780: Silence uninitialized variable warning
@ 2017-07-28 14:45 Dan Carpenter
2017-07-30 6:28 ` David Miller
0 siblings, 1 reply; 5+ messages in thread
From: Dan Carpenter @ 2017-07-28 14:45 UTC (permalink / raw)
To: Samuel Ortiz; +Cc: netdev, kernel-janitors
My static checker complains that, if the allocation in mcs_get_reg()
fails, it means we use "rval" without initializing it. Small
allocations never fail in current kernels so it's not a major concern
but it's simple enough to silence the warning.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/drivers/net/irda/mcs7780.c b/drivers/net/irda/mcs7780.c
index 765de3bedb88..64b29880e534 100644
--- a/drivers/net/irda/mcs7780.c
+++ b/drivers/net/irda/mcs7780.c
@@ -585,7 +585,7 @@ static int mcs_speed_change(struct mcs_cb *mcs)
int rst = 0;
int cnt = 0;
__u16 nspeed;
- __u16 rval;
+ __u16 rval = -1;
nspeed = mcs_speed_set[(mcs->new_speed >> 8) & 0x0f];
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH net] mcs7780: Silence uninitialized variable warning
2017-07-28 14:45 [PATCH net] mcs7780: Silence uninitialized variable warning Dan Carpenter
@ 2017-07-30 6:28 ` David Miller
2017-07-31 7:41 ` Dan Carpenter
0 siblings, 1 reply; 5+ messages in thread
From: David Miller @ 2017-07-30 6:28 UTC (permalink / raw)
To: dan.carpenter; +Cc: samuel, netdev, kernel-janitors
From: Dan Carpenter <dan.carpenter@oracle.com>
Date: Fri, 28 Jul 2017 17:45:11 +0300
> - __u16 rval;
> + __u16 rval = -1;
Fixing a bogus warning by assigning a signed constant to an
unsigned variable doesn't really make me all that happy.
I don't think I'll apply this, sorry.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net] mcs7780: Silence uninitialized variable warning
2017-07-30 6:28 ` David Miller
@ 2017-07-31 7:41 ` Dan Carpenter
2017-07-31 17:37 ` David Miller
0 siblings, 1 reply; 5+ messages in thread
From: Dan Carpenter @ 2017-07-31 7:41 UTC (permalink / raw)
To: David Miller; +Cc: samuel, netdev, kernel-janitors
On Sat, Jul 29, 2017 at 11:28:55PM -0700, David Miller wrote:
> From: Dan Carpenter <dan.carpenter@oracle.com>
> Date: Fri, 28 Jul 2017 17:45:11 +0300
>
> > - __u16 rval;
> > + __u16 rval = -1;
>
> Fixing a bogus warning by assigning a signed constant to an
> unsigned variable doesn't really make me all that happy.
>
> I don't think I'll apply this, sorry.
There's no guarantee that small kmallocs will always succeed in future
kernels so it's not *totally* bogus.
regards,
dan carpenter
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net] mcs7780: Silence uninitialized variable warning
2017-07-31 7:41 ` Dan Carpenter
@ 2017-07-31 17:37 ` David Miller
2017-08-01 10:45 ` Dan Carpenter
0 siblings, 1 reply; 5+ messages in thread
From: David Miller @ 2017-07-31 17:37 UTC (permalink / raw)
To: dan.carpenter; +Cc: samuel, netdev, kernel-janitors
From: Dan Carpenter <dan.carpenter@oracle.com>
Date: Mon, 31 Jul 2017 10:41:40 +0300
> On Sat, Jul 29, 2017 at 11:28:55PM -0700, David Miller wrote:
>> From: Dan Carpenter <dan.carpenter@oracle.com>
>> Date: Fri, 28 Jul 2017 17:45:11 +0300
>>
>> > - __u16 rval;
>> > + __u16 rval = -1;
>>
>> Fixing a bogus warning by assigning a signed constant to an
>> unsigned variable doesn't really make me all that happy.
>>
>> I don't think I'll apply this, sorry.
>
> There's no guarantee that small kmallocs will always succeed in future
> kernels so it's not *totally* bogus.
Perhaps the burdon of initializing the value belongs in
mcs_get_reg(), and you can set it properly to 0xffff
instead of -1.
Ok?
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net] mcs7780: Silence uninitialized variable warning
2017-07-31 17:37 ` David Miller
@ 2017-08-01 10:45 ` Dan Carpenter
0 siblings, 0 replies; 5+ messages in thread
From: Dan Carpenter @ 2017-08-01 10:45 UTC (permalink / raw)
To: David Miller; +Cc: samuel, netdev, kernel-janitors
On Mon, Jul 31, 2017 at 10:37:16AM -0700, David Miller wrote:
> From: Dan Carpenter <dan.carpenter@oracle.com>
> Date: Mon, 31 Jul 2017 10:41:40 +0300
>
> > On Sat, Jul 29, 2017 at 11:28:55PM -0700, David Miller wrote:
> >> From: Dan Carpenter <dan.carpenter@oracle.com>
> >> Date: Fri, 28 Jul 2017 17:45:11 +0300
> >>
> >> > - __u16 rval;
> >> > + __u16 rval = -1;
> >>
> >> Fixing a bogus warning by assigning a signed constant to an
> >> unsigned variable doesn't really make me all that happy.
> >>
> >> I don't think I'll apply this, sorry.
> >
> > There's no guarantee that small kmallocs will always succeed in future
> > kernels so it's not *totally* bogus.
>
> Perhaps the burdon of initializing the value belongs in
> mcs_get_reg(), and you can set it properly to 0xffff
> instead of -1.
>
> Ok?
Sure. I will resend.
thanks,
dan carpenter
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2017-08-01 10:45 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-28 14:45 [PATCH net] mcs7780: Silence uninitialized variable warning Dan Carpenter
2017-07-30 6:28 ` David Miller
2017-07-31 7:41 ` Dan Carpenter
2017-07-31 17:37 ` David Miller
2017-08-01 10:45 ` Dan Carpenter
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).