nvmet: check sscanf value for subsys serial attr
For nvmet in configfs.c we check return values for all the sscanf() calls. Add similar check into the nvmet_subsys_attr_serial_store(). Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Sagi Grimberg <sagi@grimberg.me> Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com> Signed-off-by: Keith Busch <kbusch@kernel.org>
This commit is contained in:
parent
013b7ebe5a
commit
d3a9b0cadf
|
@ -849,10 +849,13 @@ static ssize_t nvmet_subsys_attr_serial_show(struct config_item *item,
|
|||
static ssize_t nvmet_subsys_attr_serial_store(struct config_item *item,
|
||||
const char *page, size_t count)
|
||||
{
|
||||
struct nvmet_subsys *subsys = to_subsys(item);
|
||||
u64 serial;
|
||||
|
||||
if (sscanf(page, "%llx\n", &serial) != 1)
|
||||
return -EINVAL;
|
||||
|
||||
down_write(&nvmet_config_sem);
|
||||
sscanf(page, "%llx\n", &subsys->serial);
|
||||
to_subsys(item)->serial = serial;
|
||||
up_write(&nvmet_config_sem);
|
||||
|
||||
return count;
|
||||
|
|
Loading…
Reference in New Issue