From: James Mastros <theorb@iname.com>
To: linux-kernel@vger.kernel.org
Subject: Fwd: fs/sysfs/file.c:fill_read_buffer -- signed/unsigned bug?
Date: Sun, 25 Jul 2004 17:23:54 +0200 [thread overview]
Message-ID: <4103D08A.2040908@iname.com> (raw)
Hello, kernel hackers,
fill_read_buffer (in fs/sysfs/file.c) seems to have a signed/unsigned
bug with the return value of show. count is a ssize_t here, so I'm not
clear on why, but somehow, returning a negative value causes the
BUG_ON(count > PAGE_SIZE); to trigger. This means that returning an
error from the show function makes the kernel oops!
I'm amazed that this apparently hasn't been triggered until now. I'm
working on further sysfsification of ACPI, and I have enough problems
without the core oopsing for me on valid code. ;) (And it's even
documented that you can return errors from show functions, and there
seems to be other code in the function explicitly for dealing with error
returns, so I assume I'm not simply off the deep end.)
Unfornatly, my knowledge of C is rather lacking -- I'm not sure how to
fix this, but I'm fairly certian my diagnosis is correct.
Thanks
-=- James Mastros
reply other threads:[~2004-07-25 15:23 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=4103D08A.2040908@iname.com \
--to=theorb@iname.com \
--cc=linux-kernel@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox