lkml.org 
[lkml]   [2004]   [Jun]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [BUG 2.6.7-mm1] sysfs - possible bug
Luca Risolia <luca.risolia@studio.unibo.it> wrote:
>
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> This code causes some problems:
>
> static ssize_t sn9c102_show_i2c_val(struct class_device* cd, char* buf)
> {
> return -EIO;
> }
> static CLASS_DEVICE_ATTR(i2c_val, S_IRUGO | S_IWUSR, sn9c102_show_i2c_val, sn9c102_store_i2c_val);

Indeed it does.

> kernel BUG at fs/sysfs/file.c:93!

BUG_ON(count > PAGE_SIZE);

isn't right, because PAGE_SIZE is unsigned.

I'll send the below fix to Linus.

--- 25/fs/sysfs/file.c~sysfs-fill_read_buffer-fix 2004-06-26 19:03:11.821870464 -0700
+++ 25-akpm/fs/sysfs/file.c 2004-06-26 19:03:20.119609016 -0700
@@ -83,7 +83,7 @@ static int fill_read_buffer(struct file
return -ENOMEM;

count = ops->show(kobj,attr,buffer->page);
- BUG_ON(count > PAGE_SIZE);
+ BUG_ON(count > (ssize_t)PAGE_SIZE);
if (count >= 0)
buffer->count = count;
else
_
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 14:04    [W:0.253 / U:0.020 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site