]> www.infradead.org Git - users/jedix/linux-maple.git/commit
mwifiex: fix mwifiex_rdeeprom_read()
authorDan Carpenter <dan.carpenter@oracle.com>
Mon, 21 Sep 2015 16:19:53 +0000 (19:19 +0300)
committerChuck Anderson <chuck.anderson@oracle.com>
Fri, 5 Feb 2016 03:33:07 +0000 (19:33 -0800)
commit8d616ef3a622484d18e3de290013e75acf0c56f2
tree4f73dd095f98d5bb5bc281584af7e33435dc0ea7
parentaa9dc496aaaf781e7019e154f90a31c6ae42bd1a
mwifiex: fix mwifiex_rdeeprom_read()

Orabug: 22641689

commit 1f9c6e1bc1ba5f8a10fcd6e99d170954d7c6d382 upstream.

There were several bugs here.

1)  The done label was in the wrong place so we didn't copy any
    information out when there was no command given.

2)  We were using PAGE_SIZE as the size of the buffer instead of
    "PAGE_SIZE - pos".

3)  snprintf() returns the number of characters that would have been
    printed if there were enough space.  If there was not enough space
    (and we had fixed the memory corruption bug #2) then it would result
    in an information leak when we do simple_read_from_buffer().  I've
    changed it to use scnprintf() instead.

I also removed the initialization at the start of the function, because
I thought it made the code a little more clear.

Fixes: 5e6e3a92b9a4 ('wireless: mwifiex: initial commit for Marvell mwifiex driver')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit b0b69c7d6e11c481e5e597f5641dd883cdfcf89c)
Signed-off-by: Dan Duval <dan.duval@oracle.com>
drivers/net/wireless/mwifiex/debugfs.c