Commit f3df41cf authored by FUJITA Tomonori's avatar FUJITA Tomonori Committed by James Bottomley

[SCSI] scsi_debug: remove temporary hack around sscanf for negative values

sscanf can handle negative values.
Signed-off-by: default avatarFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Acked-by: default avatarDouglas Gilbert <dougg@torque.net>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@HansenPartnership.com>
parent 1c353f7d
...@@ -2682,20 +2682,9 @@ static ssize_t sdebug_add_host_store(struct device_driver * ddp, ...@@ -2682,20 +2682,9 @@ static ssize_t sdebug_add_host_store(struct device_driver * ddp,
const char * buf, size_t count) const char * buf, size_t count)
{ {
int delta_hosts; int delta_hosts;
char work[20];
if (1 != sscanf(buf, "%10s", work))
return -EINVAL;
{ /* temporary hack around sscanf() problem with -ve nums */
int neg = 0;
if ('-' == *work) if (sscanf(buf, "%d", &delta_hosts) != 1)
neg = 1;
if (1 != sscanf(work + neg, "%d", &delta_hosts))
return -EINVAL; return -EINVAL;
if (neg)
delta_hosts = -delta_hosts;
}
if (delta_hosts > 0) { if (delta_hosts > 0) {
do { do {
sdebug_add_adapter(); sdebug_add_adapter();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment