Skip to content

Commit a7155f4

Browse files
Dan Carpentergregkh
authored andcommitted
w1: small type cleanup in sysfs
On 64 bit systems, a large value for "long tmp" is truncated when assigning to "int md->max_slave_count" so we still end up with a value less than one despite the "tmp < 1" check. This is more of a problem for static checkers than a real life issue, but it's simple enough to fix. Acked-by: David Fries <[email protected]> Signed-off-by: Dan Carpenter <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 83b1bfb commit a7155f4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/w1/w1.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -320,10 +320,10 @@ static ssize_t w1_master_attribute_show_timeout(struct device *dev, struct devic
320320
static ssize_t w1_master_attribute_store_max_slave_count(struct device *dev,
321321
struct device_attribute *attr, const char *buf, size_t count)
322322
{
323-
long tmp;
323+
int tmp;
324324
struct w1_master *md = dev_to_w1_master(dev);
325325

326-
if (kstrtol(buf, 0, &tmp) == -EINVAL || tmp < 1)
326+
if (kstrtoint(buf, 0, &tmp) == -EINVAL || tmp < 1)
327327
return -EINVAL;
328328

329329
mutex_lock(&md->mutex);

0 commit comments

Comments
 (0)