login
Login
/
Register
Search
Search this site:
Forums
News
Blogs
Features
Site
Home
»
Mailing list archives
»
linux-kernel
»
2007
»
November
»
11
Re: [PATCH] time: fix sysfs_show_{available,current}_clocksources() buffer overflow problem
view
thread
Previous message: [
thread
] [
date
] [
author
]
Next message: [thread] [
date
] [
author
]
[view in full thread]
From: WANG Cong
Subject:
Re: [PATCH] time: fix sysfs_show_{available,current}_clocksources() buffer overflow problem
Date: Saturday, November 10, 2007 - 9:09 pm
On Sun, Nov 11, 2007 at 11:29:59AM +0800, Miao Xie wrote:
quoted text
>on 2007-11-8 20:11 WANG Cong wrote: >>On Thu, Nov 08, 2007 at 07:47:41PM +0800, WANG Cong wrote: >>>Yes, snprintf is safer than sprintf. But here, the 'count' will be >>>mis-pointed when snprintf returns no less than PAGE_SIZE (what you called >>>overflow). So you may also need: >>> >>> if (unlikely(count >= PAGE_SIZE)) >>> count = PAGE_SIZE - 1; >>> >>>Just a simple guess. ;) >> >>Or try scnprintf. ;) > >We have discussed this problem. We think that it is better to return the >return >value of kernel directly because this is the specification of the sysfs. > > (Version:2.6.24-rc2,File:Documentation/filesystems/sysfs.txt:198-201): > 198 - show() methods should return the number of bytes printed into the > 199 buffer. This is the return value of snprintf(). > 200 > 201 - show() should always use snprintf(). > >And the function which calls the show() methods uses BUG_ON() to check the >return value. If the return value is too big,it means something wrong. > >If we use scnprintf, we may not know whether the resulting string is >truncated >or not. Maybe A big bug is ignored. >
Well, i know little about sysfs. So it was just a hint. Anyway, thanks for your input! -
unsubscribe notice
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/
Previous message: [
thread
] [
date
] [
author
]
Next message: [thread] [
date
] [
author
]
Messages in current thread:
[PATCH] time: fix sysfs_show_{available,current}_clocksour ...
, Miao Xie
, (Thu Nov 8, 3:53 am)
Re: [PATCH] time: fix sysfs_show_{available,current}_clock ...
, WANG Cong
, (Thu Nov 8, 4:47 am)
Re: [PATCH] time: fix sysfs_show_{available,current}_clock ...
, WANG Cong
, (Thu Nov 8, 5:11 am)
Re: [PATCH] time: fix sysfs_show_{available,current}_clock ...
, Miao Xie
, (Sat Nov 10, 8:29 pm)
Re: [PATCH] time: fix sysfs_show_{available,current}_clock ...
, WANG Cong
, (Sat Nov 10, 9:09 pm)
Navigation
Create content
Mailing list archives
Recent posts
Popular discussions
linux-kernel
:
Trenton D. Adams
Re: Flash IO slow 1.5 MB/s
Alan Cox
Re: Please add ZFS support (from GPL sources)
S K
Re: cpufreq doesn't seem to work in Intel Q9300
Bart Van Assche
Re: Is gcc thread-unsafe?
Mingming Cao
Re: [PATCH 4/5] ext4: fallocate support in ext4
git
:
Junio C Hamano
Re: git-svnimport
Johannes Schindelin
Re: [PATCH] Fix approxidate("never") to always return 0
A Large Angry SCM
Re: [RFC] origin link for cherry-pick and revert
Mark Burton
Re: Sporadic BSOD with msys git?
Junio C Hamano
Re: [PATCH] Detached HEAD (experimental)
git-commits-head
:
Linux Kernel Mailing List
ath9k_htc: Allocate URBs properly
Linux Kernel Mailing List
sm501: add power control callback
Linux Kernel Mailing List
net: don't grab a mutex within a timer context in gianfar
Linux Kernel Mailing List
powerpc/kexec: Add support for FSL-BookE
Linux Kernel Mailing List
V4L/DVB (8976): af9015: Add USB ID for AVerMedia A309
linux-netdev
:
Daniel Lezcano
getsockopt(TCP_DEFER_ACCEPT) value change
David Miller
Re: 2.6.27.18: bnx2/tg3: BUG: "scheduling while atomic" trying to ifenslave a seco...
David Miller
Re: [RFC 0/5] generic rx recycling
Ingo Molnar
Re: [regression] nf_iterate(), BUG: unable to handle kernel NULL pointer dereference
Jeff Kirsher
[net-2.6 PATCH 2/5] e1000e: increase swflag acquisition timeout for ICHx/PCH
openbsd-misc
:
daniele.pilenga
snmpd hangs on 4.1 looking up hrSWRunTable
Christophe Rioux
Implementation example of snmp
Nick Holland
Re: booting openbsd on eee without cd-rom
Cabillot Julien
Re: OpenBSD isakmpd and pf vs Cisco PIX or ASA
Nice Daemon
Re: Bind ntpd on certain interface?
Colocation donated by:
Syndicate