All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@osdl.org>
To: Luca Risolia <luca.risolia@studio.unibo.it>
Cc: linux-kernel@vger.kernel.org, Greg KH <greg@kroah.com>
Subject: Re: [BUG 2.6.7-mm1] sysfs - possible bug
Date: Sat, 26 Jun 2004 19:08:35 -0700	[thread overview]
Message-ID: <20040626190835.68eb63cb.akpm@osdl.org> (raw)
In-Reply-To: <20040627065816.11c3e28d.luca.risolia@studio.unibo.it>

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
_


      reply	other threads:[~2004-06-27  2:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-06-27  4:58 [BUG 2.6.7-mm1] sysfs - possible bug Luca Risolia
2004-06-27  2:08 ` Andrew Morton [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040626190835.68eb63cb.akpm@osdl.org \
    --to=akpm@osdl.org \
    --cc=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luca.risolia@studio.unibo.it \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.