Commit 14f79dfc authored by Arnd Bergmann's avatar Arnd Bergmann Committed by Kleber Sacilotto de Souza

isdn: kcapi: avoid uninitialized data

BugLink: http://bugs.launchpad.net/bugs/1745054

[ Upstream commit af109a2c ]

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: default avatarArnd Bergmann <arnd@arndb.de>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarSasha Levin <alexander.levin@verizon.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarKhalid Elmously <khalid.elmously@canonical.com>
Signed-off-by: default avatarStefan Bader <stefan.bader@canonical.com>
parent 436e5a3a
...@@ -1032,6 +1032,7 @@ static int old_capi_manufacturer(unsigned int cmd, void __user *data) ...@@ -1032,6 +1032,7 @@ static int old_capi_manufacturer(unsigned int cmd, void __user *data)
sizeof(avmb1_carddef)))) sizeof(avmb1_carddef))))
return -EFAULT; return -EFAULT;
cdef.cardtype = AVM_CARDTYPE_B1; cdef.cardtype = AVM_CARDTYPE_B1;
cdef.cardnr = 0;
} else { } else {
if ((retval = copy_from_user(&cdef, data, if ((retval = copy_from_user(&cdef, data,
sizeof(avmb1_extcarddef)))) sizeof(avmb1_extcarddef))))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment