All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Thomas Maier" <balagi@justmail.de>
To: "Greg KH" <gregkh@suse.de>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] 2.6.19-rc2-mm2 sysfs: sysfs_write_file() writes zero terminated data
Date: Mon, 23 Oct 2006 22:02:03 +0200	[thread overview]
Message-ID: <op.thv4lpt0iudtyh@master> (raw)
In-Reply-To: <20061022183924.GA18032@suse.de>

Hello,

Sorry, maybe i missed something, but according to the
code in fs/sysfs/file.c the "write" sequence is:

- call to sysfs_write_file(ubuf, count)
- if (!sysfsbuf->page)  alloc zeroed page
- copy count bytes from ubuf to sysfsbuf->page
- call store(sysfsbuf->page, count)

When you write again to the file before closing it
(possible?!), and count is less the the previous count
you may not pass a zero terminated string/data to store().

-Thomas


Am 22.10.2006, 20:39 Uhr, schrieb Greg KH <gregkh@suse.de>:

> On Sun, Oct 22, 2006 at 07:17:47PM +0200, Thomas Maier wrote:
>> Hello,
>>
>> since most of the files in sysfs are text files,
>> it would be nice, if the "store" function called
>> during sysfs_write_file() gets a zero terminated
>> string / data.
>> The current implementation seems not to ensure this.
>> (But only if it is the first time the zeroed buffer
>> page is allocated.)
>
> Have you seen sysfs buffers being passed to the store() function in a
> non-null terminated manner?  How?
>
> Are you seeking backward and then writing again to the file somehow?
>
> thanks,
>
> greg k-h
>
>



  reply	other threads:[~2006-10-23 19:59 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-22 17:17 [PATCH] 2.6.19-rc2-mm2 sysfs: sysfs_write_file() writes zero terminated data Thomas Maier
2006-10-22 18:39 ` Greg KH
2006-10-23 20:02   ` Thomas Maier [this message]
2006-10-23 21:18     ` Greg KH
  -- strict thread matches above, loose matches on Subject: below --
2006-10-26 12:08 balagi

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=op.thv4lpt0iudtyh@master \
    --to=balagi@justmail.de \
    --cc=gregkh@suse.de \
    --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 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.