staging: wfx: check memory allocation
authorJérôme Pouiller <jerome.pouiller@silabs.com>
Fri, 9 Oct 2020 17:13:01 +0000 (19:13 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 10 Oct 2020 10:33:59 +0000 (12:33 +0200)
commitfd2575c4a45017068445bfe31e93522e2d451d76
treeec27c8742887bd029f36b9e699110a272b5028e7
parent1cd8909642183804904e3ad6292dcee92fc7d005
staging: wfx: check memory allocation

Smatch complains:

   main.c:228 wfx_send_pdata_pds() warn: potential NULL parameter dereference 'tmp_buf'
   227          tmp_buf = kmemdup(pds->data, pds->size, GFP_KERNEL);
   228          ret = wfx_send_pds(wdev, tmp_buf, pds->size);
                                         ^^^^^^^
   229          kfree(tmp_buf);

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
Link: https://lore.kernel.org/r/20201009171307.864608-3-Jerome.Pouiller@silabs.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/wfx/main.c