public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <greg@kroah.com>
To: Mitch Williams <mitch.a.williams@intel.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/3] buffer writes to sysfs
Date: Mon, 31 Jan 2005 22:30:24 -0800	[thread overview]
Message-ID: <20050201063024.GA15179@kroah.com> (raw)
In-Reply-To: <Pine.CYG.4.58.0501251519390.2388@mawilli1-desk2.amr.corp.intel.com>

On Tue, Jan 25, 2005 at 03:39:00PM -0800, Mitch Williams wrote:
> 
> 
> On Mon, 24 Jan 2005, Greg KH wrote:
> >
> > Who is trying to send > 1K to a sysfs file?  Remember, sysfs files are
> > for 1 value only.  If you consider > 1K a "single value" please point me
> > to that part of the kernel that does that.
> >
> > > To the typical user, there's really no difference in behavior, unless
> > you
> > > are writing a ton of data into the file.  Of course, there's the
> > obvious
> > > question of why you'd want to do so...
> >
> > Exactly, you should not be doing that anyway.  So, because of that, I
> > really don't want/like this patch.
> 
> 
> OK, I've had a day to think about this, and I think I have a good answer
> now.
> 
> Leaving aside the issue of how big a 'single object' is, we still have to
> consider the possibility that a user _will_ indeed someday try to write 4K
> (or more) to a sysfs file.  It's just going to happen.  And right now, the
> kernel's behavior in that event is unpredictable, because we don't know
> how the c library is going to buffer this write.

That's your C library, probably not mine :)

Anyway, sure, I can see that we want to handle this in a sane manner.

> diff -urpN -X dontdiff linux-2.6.11-clean/fs/sysfs/file.c linux-2.6.11/fs/sysfs/file.c
> --- linux-2.6.11-clean/fs/sysfs/file.c	2004-12-24 13:33:50.000000000 -0800
> +++ linux-2.6.11/fs/sysfs/file.c	2005-01-25 10:47:15.000000000 -0800
> @@ -232,6 +232,8 @@ sysfs_write_file(struct file *file, cons
>  {
>  	struct sysfs_buffer * buffer = file->private_data;
> 
> +        if (*ppos > 0)
> +            return -EIO;
>  	down(&buffer->sem);
>  	count = fill_write_buffer(buffer,buf,count);
>  	if (count > 0)

You are using spaces instead of tabs :(

Care to redo it?

thanks,

greg k-h

      parent reply	other threads:[~2005-02-01  7:40 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-21 22:52 [PATCH 2/3] buffer writes to sysfs Mitch Williams
2005-01-22  8:09 ` Greg KH
2005-01-24 18:37   ` Mitch Williams
2005-01-24 21:39     ` Greg KH
2005-01-25 23:39       ` Mitch Williams
2005-01-27 18:28         ` Bill Davidsen
2005-02-01  6:30         ` Greg KH [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=20050201063024.GA15179@kroah.com \
    --to=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mitch.a.williams@intel.com \
    /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