projects
/
platform
/
adaptation
/
renesas_rcar
/
renesas_kernel.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[SCSI] prevent stack buffer overflow in host_reset
[platform/adaptation/renesas_rcar/renesas_kernel.git]
/
drivers
/
scsi
/
scsi_sysfs.c
diff --git
a/drivers/scsi/scsi_sysfs.c
b/drivers/scsi/scsi_sysfs.c
index
ce5224c
..
931a7d9
100644
(file)
--- a/
drivers/scsi/scsi_sysfs.c
+++ b/
drivers/scsi/scsi_sysfs.c
@@
-247,11
+247,11
@@
show_shost_active_mode(struct device *dev,
static DEVICE_ATTR(active_mode, S_IRUGO | S_IWUSR, show_shost_active_mode, NULL);
static DEVICE_ATTR(active_mode, S_IRUGO | S_IWUSR, show_shost_active_mode, NULL);
-static int check_reset_type(char *str)
+static int check_reset_type(c
onst c
har *str)
{
{
- if (s
trncmp(str, "adapter", 10) == 0
)
+ if (s
ysfs_streq(str, "adapter")
)
return SCSI_ADAPTER_RESET;
return SCSI_ADAPTER_RESET;
- else if (s
trncmp(str, "firmware", 10) == 0
)
+ else if (s
ysfs_streq(str, "firmware")
)
return SCSI_FIRMWARE_RESET;
else
return 0;
return SCSI_FIRMWARE_RESET;
else
return 0;
@@
-264,12
+264,9
@@
store_host_reset(struct device *dev, struct device_attribute *attr,
struct Scsi_Host *shost = class_to_shost(dev);
struct scsi_host_template *sht = shost->hostt;
int ret = -EINVAL;
struct Scsi_Host *shost = class_to_shost(dev);
struct scsi_host_template *sht = shost->hostt;
int ret = -EINVAL;
- char str[10];
int type;
int type;
- sscanf(buf, "%s", str);
- type = check_reset_type(str);
-
+ type = check_reset_type(buf);
if (!type)
goto exit_store_host_reset;
if (!type)
goto exit_store_host_reset;