linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] media: Fix get_key_haup_common.isra.4() debug message to print ptoggle value
@ 2016-11-07 15:41 Shuah Khan
  2016-11-07 15:41 ` [PATCH] media: fix uninitialized variable warning in dib0700_rc_urb_completion() Shuah Khan
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Shuah Khan @ 2016-11-07 15:41 UTC (permalink / raw)
  To: mchehab, javier, arnd, sean; +Cc: Shuah Khan, linux-media, linux-kernel

Fix the debug message in get_key_haup_common.isra.4() doesn't print the
correct toggle value. Fix it. This shows up as an used uninitialized warn
message:

drivers/media/i2c/ir-kbd-i2c.c: In function ‘get_key_haup_common.isra.4’:
 drivers/media/i2c/ir-kbd-i2c.c:62:2: warning: ‘toggle’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   printk(KERN_DEBUG MODULE_NAME ": " fmt , ## arg)
   ^~~~~~
 drivers/media/i2c/ir-kbd-i2c.c:70:20: note: ‘toggle’ was declared here
   int start, range, toggle, dev, code, ircode, vendor;
                     ^~~~~~

Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
---
 drivers/media/i2c/ir-kbd-i2c.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/i2c/ir-kbd-i2c.c b/drivers/media/i2c/ir-kbd-i2c.c
index f95a6bc..cede397 100644
--- a/drivers/media/i2c/ir-kbd-i2c.c
+++ b/drivers/media/i2c/ir-kbd-i2c.c
@@ -118,7 +118,7 @@ static int get_key_haup_common(struct IR_i2c *ir, enum rc_type *protocol,
 			*protocol = RC_TYPE_RC6_MCE;
 			dev &= 0x7f;
 			dprintk(1, "ir hauppauge (rc6-mce): t%d vendor=%d dev=%d code=%d\n",
-						toggle, vendor, dev, code);
+						*ptoggle, vendor, dev, code);
 		} else {
 			*ptoggle = 0;
 			*protocol = RC_TYPE_RC6_6A_32;
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH] media: fix uninitialized variable warning in dib0700_rc_urb_completion()
  2016-11-07 15:41 [PATCH] media: Fix get_key_haup_common.isra.4() debug message to print ptoggle value Shuah Khan
@ 2016-11-07 15:41 ` Shuah Khan
  2016-11-08 11:23   ` Sean Young
  2016-11-07 15:41 ` [PATCH] net/netfiliter: Fix used uninitialized warn in ip_vs_proc_sync_conn() Shuah Khan
  2016-11-07 15:41 ` [PATCH] net/netfilter: Fix use uninitialized warn in nft_range_eval() Shuah Khan
  2 siblings, 1 reply; 8+ messages in thread
From: Shuah Khan @ 2016-11-07 15:41 UTC (permalink / raw)
  To: mchehab, wsa-dev, gregkh, keescook, akpm, sean, patrick.boettcher
  Cc: Shuah Khan, linux-media, linux-kernel

Fix the following uninitialized variable compiler warning:

drivers/media/usb/dvb-usb/dib0700_core.c: In function ‘dib0700_rc_urb_completion’:
 drivers/media/usb/dvb-usb/dib0700_core.c:763:2: warning: ‘protocol’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   rc_keydown(d->rc_dev, protocol, keycode, toggle);
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
---
 drivers/media/usb/dvb-usb/dib0700_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/usb/dvb-usb/dib0700_core.c b/drivers/media/usb/dvb-usb/dib0700_core.c
index f319665..cfe28ec 100644
--- a/drivers/media/usb/dvb-usb/dib0700_core.c
+++ b/drivers/media/usb/dvb-usb/dib0700_core.c
@@ -676,7 +676,7 @@ static void dib0700_rc_urb_completion(struct urb *purb)
 {
 	struct dvb_usb_device *d = purb->context;
 	struct dib0700_rc_response *poll_reply;
-	enum rc_type protocol;
+	enum rc_type protocol = RC_TYPE_UNKNOWN;
 	u32 uninitialized_var(keycode);
 	u8 toggle;
 
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH] net/netfiliter: Fix used uninitialized warn in ip_vs_proc_sync_conn()
  2016-11-07 15:41 [PATCH] media: Fix get_key_haup_common.isra.4() debug message to print ptoggle value Shuah Khan
  2016-11-07 15:41 ` [PATCH] media: fix uninitialized variable warning in dib0700_rc_urb_completion() Shuah Khan
@ 2016-11-07 15:41 ` Shuah Khan
  2016-11-07 15:44   ` Anna Schumaker
  2016-11-07 15:41 ` [PATCH] net/netfilter: Fix use uninitialized warn in nft_range_eval() Shuah Khan
  2 siblings, 1 reply; 8+ messages in thread
From: Shuah Khan @ 2016-11-07 15:41 UTC (permalink / raw)
  To: trond.myklebust, anna.schumaker; +Cc: Shuah Khan, linux-nfs, linux-kernel

Fix the following warn:

 net/netfilter/ipvs/ip_vs_sync.c: In function ‘ip_vs_proc_sync_conn’:
 net/netfilter/ipvs/ip_vs_sync.c:1069:33: warning: ‘opt.init_seq’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   struct ip_vs_sync_conn_options opt;
                                  ^~~
 net/netfilter/ipvs/ip_vs_sync.c:1069:33: warning: ‘opt.delta’ may be used uninitialized in this function [-Wmaybe-uninitialized]
 net/netfilter/ipvs/ip_vs_sync.c:1069:33: warning: ‘opt.previous_delta’ may be used uninitialized in this function [-Wmaybe-uninitialized]
 net/netfilter/ipvs/ip_vs_sync.c:1069:33: warning: ‘*((void *)&opt+12).init_seq’ may be used uninitialized in this function [-Wmaybe-uninitialized]
 net/netfilter/ipvs/ip_vs_sync.c:1069:33: warning: ‘*((void *)&opt+12).delta’ may be used uninitialized in this function [-Wmaybe-uninitialized]
 net/netfilter/ipvs/ip_vs_sync.c:1069:33: warning: ‘*((void *)&opt+12).previous_delta’ may be used uninitialized in this function [-Wmaybe-uninitialized]

Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
---
 fs/nfs/nfs4session.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/nfs/nfs4session.c b/fs/nfs/nfs4session.c
index b629730..68e700e 100644
--- a/fs/nfs/nfs4session.c
+++ b/fs/nfs/nfs4session.c
@@ -196,7 +196,7 @@ static int nfs4_slot_get_seqid(struct nfs4_slot_table  *tbl, u32 slotid,
 static bool nfs4_slot_seqid_in_use(struct nfs4_slot_table *tbl,
 		u32 slotid, u32 seq_nr)
 {
-	u32 cur_seq;
+	u32 cur_seq = 0;
 	bool ret = false;
 
 	spin_lock(&tbl->slot_tbl_lock);
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH] net/netfilter: Fix use uninitialized warn in nft_range_eval()
  2016-11-07 15:41 [PATCH] media: Fix get_key_haup_common.isra.4() debug message to print ptoggle value Shuah Khan
  2016-11-07 15:41 ` [PATCH] media: fix uninitialized variable warning in dib0700_rc_urb_completion() Shuah Khan
  2016-11-07 15:41 ` [PATCH] net/netfiliter: Fix used uninitialized warn in ip_vs_proc_sync_conn() Shuah Khan
@ 2016-11-07 15:41 ` Shuah Khan
  2016-11-08 23:13   ` Pablo Neira Ayuso
  2 siblings, 1 reply; 8+ messages in thread
From: Shuah Khan @ 2016-11-07 15:41 UTC (permalink / raw)
  To: pablo, kaber, kadlec, davem
  Cc: Shuah Khan, netfilter-devel, coreteam, netdev, linux-kernel

Fix the following warn:

   CC [M]  net/netfilter/nft_range.o
8601,8605c9105
 net/netfilter/nft_range.c: In function ‘nft_range_eval’:
 net/netfilter/nft_range.c:45:5: warning: ‘mismatch’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   if (mismatch)
      ^

Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
---
 net/netfilter/nft_range.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/netfilter/nft_range.c b/net/netfilter/nft_range.c
index c6d5358..fe5f69b 100644
--- a/net/netfilter/nft_range.c
+++ b/net/netfilter/nft_range.c
@@ -28,7 +28,7 @@ static void nft_range_eval(const struct nft_expr *expr,
 			 const struct nft_pktinfo *pkt)
 {
 	const struct nft_range_expr *priv = nft_expr_priv(expr);
-	bool mismatch;
+	bool mismatch = false;
 	int d1, d2;
 
 	d1 = memcmp(&regs->data[priv->sreg], &priv->data_from, priv->len);
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH] net/netfiliter: Fix used uninitialized warn in ip_vs_proc_sync_conn()
  2016-11-07 15:41 ` [PATCH] net/netfiliter: Fix used uninitialized warn in ip_vs_proc_sync_conn() Shuah Khan
@ 2016-11-07 15:44   ` Anna Schumaker
  2016-11-07 16:14     ` Shuah Khan
  0 siblings, 1 reply; 8+ messages in thread
From: Anna Schumaker @ 2016-11-07 15:44 UTC (permalink / raw)
  To: Shuah Khan, trond.myklebust; +Cc: linux-nfs, linux-kernel

Hi Shuah,

On 11/07/2016 10:41 AM, Shuah Khan wrote:
> Fix the following warn:
> 
>  net/netfilter/ipvs/ip_vs_sync.c: In function ‘ip_vs_proc_sync_conn’:
>  net/netfilter/ipvs/ip_vs_sync.c:1069:33: warning: ‘opt.init_seq’ may be used uninitialized in this function [-Wmaybe-uninitialized]
>    struct ip_vs_sync_conn_options opt;
>                                   ^~~
>  net/netfilter/ipvs/ip_vs_sync.c:1069:33: warning: ‘opt.delta’ may be used uninitialized in this function [-Wmaybe-uninitialized]
>  net/netfilter/ipvs/ip_vs_sync.c:1069:33: warning: ‘opt.previous_delta’ may be used uninitialized in this function [-Wmaybe-uninitialized]
>  net/netfilter/ipvs/ip_vs_sync.c:1069:33: warning: ‘*((void *)&opt+12).init_seq’ may be used uninitialized in this function [-Wmaybe-uninitialized]
>  net/netfilter/ipvs/ip_vs_sync.c:1069:33: warning: ‘*((void *)&opt+12).delta’ may be used uninitialized in this function [-Wmaybe-uninitialized]
>  net/netfilter/ipvs/ip_vs_sync.c:1069:33: warning: ‘*((void *)&opt+12).previous_delta’ may be used uninitialized in this function [-Wmaybe-uninitialized]

Are you sure you put the right commit message on this patch?  The message describes a warning in ip_vs_sync.c, but the patch is for nfs4session.c.

Thanks,
Anna

> 
> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
> ---
>  fs/nfs/nfs4session.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/nfs/nfs4session.c b/fs/nfs/nfs4session.c
> index b629730..68e700e 100644
> --- a/fs/nfs/nfs4session.c
> +++ b/fs/nfs/nfs4session.c
> @@ -196,7 +196,7 @@ static int nfs4_slot_get_seqid(struct nfs4_slot_table  *tbl, u32 slotid,
>  static bool nfs4_slot_seqid_in_use(struct nfs4_slot_table *tbl,
>  		u32 slotid, u32 seq_nr)
>  {
> -	u32 cur_seq;
> +	u32 cur_seq = 0;
>  	bool ret = false;
>  
>  	spin_lock(&tbl->slot_tbl_lock);
> 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] net/netfiliter: Fix used uninitialized warn in ip_vs_proc_sync_conn()
  2016-11-07 15:44   ` Anna Schumaker
@ 2016-11-07 16:14     ` Shuah Khan
  0 siblings, 0 replies; 8+ messages in thread
From: Shuah Khan @ 2016-11-07 16:14 UTC (permalink / raw)
  To: Anna Schumaker, trond.myklebust; +Cc: linux-nfs, linux-kernel, Shuah Khan

On 11/07/2016 08:44 AM, Anna Schumaker wrote:
> Hi Shuah,
> 
> On 11/07/2016 10:41 AM, Shuah Khan wrote:
>> Fix the following warn:
>>
>>  net/netfilter/ipvs/ip_vs_sync.c: In function ‘ip_vs_proc_sync_conn’:
>>  net/netfilter/ipvs/ip_vs_sync.c:1069:33: warning: ‘opt.init_seq’ may be used uninitialized in this function [-Wmaybe-uninitialized]
>>    struct ip_vs_sync_conn_options opt;
>>                                   ^~~
>>  net/netfilter/ipvs/ip_vs_sync.c:1069:33: warning: ‘opt.delta’ may be used uninitialized in this function [-Wmaybe-uninitialized]
>>  net/netfilter/ipvs/ip_vs_sync.c:1069:33: warning: ‘opt.previous_delta’ may be used uninitialized in this function [-Wmaybe-uninitialized]
>>  net/netfilter/ipvs/ip_vs_sync.c:1069:33: warning: ‘*((void *)&opt+12).init_seq’ may be used uninitialized in this function [-Wmaybe-uninitialized]
>>  net/netfilter/ipvs/ip_vs_sync.c:1069:33: warning: ‘*((void *)&opt+12).delta’ may be used uninitialized in this function [-Wmaybe-uninitialized]
>>  net/netfilter/ipvs/ip_vs_sync.c:1069:33: warning: ‘*((void *)&opt+12).previous_delta’ may be used uninitialized in this function [-Wmaybe-uninitialized]
> 
> Are you sure you put the right commit message on this patch?  The message describes a warning in ip_vs_sync.c, but the patch is for nfs4session.c.
> 
> Thanks,
> Anna

Oops. Sorry about this. Bad cut and paste from make output.
I will resend the patch with the correct changelog

thanks,
-- Shuah

> 
>>
>> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
>> ---
>>  fs/nfs/nfs4session.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/fs/nfs/nfs4session.c b/fs/nfs/nfs4session.c
>> index b629730..68e700e 100644
>> --- a/fs/nfs/nfs4session.c
>> +++ b/fs/nfs/nfs4session.c
>> @@ -196,7 +196,7 @@ static int nfs4_slot_get_seqid(struct nfs4_slot_table  *tbl, u32 slotid,
>>  static bool nfs4_slot_seqid_in_use(struct nfs4_slot_table *tbl,
>>  		u32 slotid, u32 seq_nr)
>>  {
>> -	u32 cur_seq;
>> +	u32 cur_seq = 0;
>>  	bool ret = false;
>>  
>>  	spin_lock(&tbl->slot_tbl_lock);
>>
> 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] media: fix uninitialized variable warning in dib0700_rc_urb_completion()
  2016-11-07 15:41 ` [PATCH] media: fix uninitialized variable warning in dib0700_rc_urb_completion() Shuah Khan
@ 2016-11-08 11:23   ` Sean Young
  0 siblings, 0 replies; 8+ messages in thread
From: Sean Young @ 2016-11-08 11:23 UTC (permalink / raw)
  To: Shuah Khan
  Cc: mchehab, wsa-dev, gregkh, keescook, akpm, patrick.boettcher,
	linux-media, linux-kernel

On Mon, Nov 07, 2016 at 08:41:12AM -0700, Shuah Khan wrote:
> Fix the following uninitialized variable compiler warning:
> 
> drivers/media/usb/dvb-usb/dib0700_core.c: In function ‘dib0700_rc_urb_completion’:
>  drivers/media/usb/dvb-usb/dib0700_core.c:763:2: warning: ‘protocol’ may be used uninitialized in this function [-Wmaybe-uninitialized]
>    rc_keydown(d->rc_dev, protocol, keycode, toggle);
>    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 
> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
> ---
>  drivers/media/usb/dvb-usb/dib0700_core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/media/usb/dvb-usb/dib0700_core.c b/drivers/media/usb/dvb-usb/dib0700_core.c
> index f319665..cfe28ec 100644
> --- a/drivers/media/usb/dvb-usb/dib0700_core.c
> +++ b/drivers/media/usb/dvb-usb/dib0700_core.c
> @@ -676,7 +676,7 @@ static void dib0700_rc_urb_completion(struct urb *purb)
>  {
>  	struct dvb_usb_device *d = purb->context;
>  	struct dib0700_rc_response *poll_reply;
> -	enum rc_type protocol;
> +	enum rc_type protocol = RC_TYPE_UNKNOWN;
>  	u32 uninitialized_var(keycode);
>  	u8 toggle;
>  

There is another (better) fix for it here:

https://patchwork.linuxtv.org/patch/37516/


Thanks
Sean

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] net/netfilter: Fix use uninitialized warn in nft_range_eval()
  2016-11-07 15:41 ` [PATCH] net/netfilter: Fix use uninitialized warn in nft_range_eval() Shuah Khan
@ 2016-11-08 23:13   ` Pablo Neira Ayuso
  0 siblings, 0 replies; 8+ messages in thread
From: Pablo Neira Ayuso @ 2016-11-08 23:13 UTC (permalink / raw)
  To: Shuah Khan
  Cc: kaber, kadlec, davem, netfilter-devel, coreteam, netdev, linux-kernel

On Mon, Nov 07, 2016 at 08:41:14AM -0700, Shuah Khan wrote:
> Fix the following warn:
> 
>    CC [M]  net/netfilter/nft_range.o
> 8601,8605c9105
>  net/netfilter/nft_range.c: In function ‘nft_range_eval’:
>  net/netfilter/nft_range.c:45:5: warning: ‘mismatch’ may be used uninitialized in this function [-Wmaybe-uninitialized]
>    if (mismatch)
>       ^

You probably using an old tree snapshot? This was already fixed by:

commit d2e4d593516e877f1f6fb40031eb495f36606e16
Author: Arnd Bergmann <arnd@arndb.de>
Date:   Tue Oct 18 00:05:30 2016 +0200

    netfilter: nf_tables: avoid uninitialized variable warning

    The newly added nft_range_eval() function handles the two possible
    nft range operations, but as the compiler warning points out,
    any unexpected value would lead to the 'mismatch' variable being
    used without being initialized:

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2016-11-08 23:13 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-07 15:41 [PATCH] media: Fix get_key_haup_common.isra.4() debug message to print ptoggle value Shuah Khan
2016-11-07 15:41 ` [PATCH] media: fix uninitialized variable warning in dib0700_rc_urb_completion() Shuah Khan
2016-11-08 11:23   ` Sean Young
2016-11-07 15:41 ` [PATCH] net/netfiliter: Fix used uninitialized warn in ip_vs_proc_sync_conn() Shuah Khan
2016-11-07 15:44   ` Anna Schumaker
2016-11-07 16:14     ` Shuah Khan
2016-11-07 15:41 ` [PATCH] net/netfilter: Fix use uninitialized warn in nft_range_eval() Shuah Khan
2016-11-08 23:13   ` Pablo Neira Ayuso

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).