From dtor_core@ameritech.net Thu Aug 18 23:20:05 2005
From: Dmitry Torokhov <dtor_core@ameritech.net>
To: linux-kernel@vger.kernel.org
Subject: sysfs: write should return ENOBUFS
Date: Fri, 19 Aug 2005 00:55:25 -0500
Cc: Greg KH <gregkh@suse.de>
Message-Id: <200508190055.25747.dtor_core@ameritech.net>


According to the SuS write() can not return ENOMEM, only ENOBUFS is allowed
(surprisingly read() is allowed to use both ENOMEM and ENOBUFS):

http://www.opengroup.org/onlinepubs/000095399/functions/write.html

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
 fs/sysfs/file.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- gregkh-2.6.orig/fs/sysfs/file.c	2005-08-19 00:17:45.000000000 -0700
+++ gregkh-2.6/fs/sysfs/file.c	2005-08-19 00:21:39.000000000 -0700
@@ -180,7 +180,7 @@ fill_write_buffer(struct sysfs_buffer * 
 	if (!buffer->page)
 		buffer->page = (char *)get_zeroed_page(GFP_KERNEL);
 	if (!buffer->page)
-		return -ENOMEM;
+		return -ENOBUFS;
 
 	if (count >= PAGE_SIZE)
 		count = PAGE_SIZE;