]> git.baikalelectronics.ru Git - kernel.git/commit
eeprom: idt_89hpesx: uninitialized data in idt_dbgfs_csr_write()
authorDan Carpenter <dan.carpenter@oracle.com>
Fri, 8 Jul 2022 13:46:38 +0000 (16:46 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 17 Aug 2022 12:23:52 +0000 (14:23 +0200)
commit67d7d424f1dbc685d12aa81af4d6e5ee9a3c7c62
tree381a6f25d22508c1d33154fadcb3296c52a5e9e8
parent444027d4343fdd4ee143ad8c565988f23f23d542
eeprom: idt_89hpesx: uninitialized data in idt_dbgfs_csr_write()

[ Upstream commit aa821c499255acb61c8e56d435def37a7c84626e ]

The simple_write_to_buffer() function will return positive/success if it
is able to write a single byte anywhere within the buffer.  However that
potentially leaves a lot of the buffer uninitialized.

In this code it's better to return 0 if the offset is non-zero.  This
code is not written to support partial writes.  And then return -EFAULT
if the buffer is not completely initialized.

Fixes: 5ebcf84aacc1 ("eeprom: Add IDT 89HPESx EEPROM/CSR driver")
Reviewed-by: Serge Semin <fancer.lancer@gmail.com>
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/r/Ysg1Pu/nzSMe3r1q@kili
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/misc/eeprom/idt_89hpesx.c