staging: rtl8712: uninitialized memory in read_bbreg_hdl()
authorDan Carpenter <dan.carpenter@oracle.com>
Thu, 21 Mar 2019 06:26:38 +0000 (09:26 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 4 May 2019 06:49:08 +0000 (08:49 +0200)
commit63bbfd0631c9745b9d855caa6630f0c7c89e538e
treedde4e83f26c12213763ac78973003b88e6a35282
parenta3c43491f7dbebfd3e4d2223faf8363ccc5c08cd
staging: rtl8712: uninitialized memory in read_bbreg_hdl()

[ Upstream commit 22c971db7dd4b0ad8dd88e99c407f7a1f4231a2e ]

Colin King reported a bug in read_bbreg_hdl():

memcpy(pcmd->rsp, (u8 *)&val, pcmd->rspsz);

The problem is that "val" is uninitialized.

This code is obviously not useful, but so far as I can tell
"pcmd->cmdcode" is never GEN_CMD_CODE(_Read_BBREG) so it's not harmful
either.  For now the easiest fix is to just call r8712_free_cmd_obj()
and return.

Fixes: 2865d42c78a9 ("staging: r8712u: Add the new driver to the mainline kernel")
Reported-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin (Microsoft) <sashal@kernel.org>
drivers/staging/rtl8712/rtl8712_cmd.c
drivers/staging/rtl8712/rtl8712_cmd.h