linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH, net] isdn: kcapi: avoid uninitialized data
@ 2017-03-28 10:11 Arnd Bergmann
  2017-03-29  0:59 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Arnd Bergmann @ 2017-03-28 10:11 UTC (permalink / raw)
  To: Karsten Keil
  Cc: David S . Miller, Arnd Bergmann, Ingo Molnar, netdev, linux-kernel

gcc-7 points out that the AVMB1_ADDCARD ioctl results in an unintialized
value ending up in the cardnr parameter:

drivers/isdn/capi/kcapi.c: In function 'old_capi_manufacturer':
drivers/isdn/capi/kcapi.c:1042:24: error: 'cdef.cardnr' may be used uninitialized in this function [-Werror=maybe-uninitialized]
   cparams.cardnr = cdef.cardnr;

This has been broken since before the start of the git history, so
either the value is not used for anything important, or the ioctl
command doesn't get called in practice.

Setting the cardnr to zero avoids the warning and makes sure
we have consistent behavior.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/isdn/capi/kcapi.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/isdn/capi/kcapi.c b/drivers/isdn/capi/kcapi.c
index 1dfd1085a04f..9ca691d6c13b 100644
--- a/drivers/isdn/capi/kcapi.c
+++ b/drivers/isdn/capi/kcapi.c
@@ -1032,6 +1032,7 @@ static int old_capi_manufacturer(unsigned int cmd, void __user *data)
 						     sizeof(avmb1_carddef))))
 				return -EFAULT;
 			cdef.cardtype = AVM_CARDTYPE_B1;
+			cdef.cardnr = 0;
 		} else {
 			if ((retval = copy_from_user(&cdef, data,
 						     sizeof(avmb1_extcarddef))))
-- 
2.9.0

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

* Re: [PATCH, net] isdn: kcapi: avoid uninitialized data
  2017-03-28 10:11 [PATCH, net] isdn: kcapi: avoid uninitialized data Arnd Bergmann
@ 2017-03-29  0:59 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2017-03-29  0:59 UTC (permalink / raw)
  To: arnd; +Cc: isdn, mingo, netdev, linux-kernel

From: Arnd Bergmann <arnd@arndb.de>
Date: Tue, 28 Mar 2017 12:11:07 +0200

> gcc-7 points out that the AVMB1_ADDCARD ioctl results in an unintialized
> value ending up in the cardnr parameter:
> 
> drivers/isdn/capi/kcapi.c: In function 'old_capi_manufacturer':
> drivers/isdn/capi/kcapi.c:1042:24: error: 'cdef.cardnr' may be used uninitialized in this function [-Werror=maybe-uninitialized]
>    cparams.cardnr = cdef.cardnr;
> 
> This has been broken since before the start of the git history, so
> either the value is not used for anything important, or the ioctl
> command doesn't get called in practice.
> 
> Setting the cardnr to zero avoids the warning and makes sure
> we have consistent behavior.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Applied.

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

end of thread, other threads:[~2017-03-29  0:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-28 10:11 [PATCH, net] isdn: kcapi: avoid uninitialized data Arnd Bergmann
2017-03-29  0:59 ` David Miller

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