public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: LW@KARO-electronics.de (Lothar Waßmann)
To: linux-arm-kernel@lists.infradead.org
Subject: userspace firmware load fails with current linux-next
Date: Wed, 23 Oct 2013 12:43:33 +0200	[thread overview]
Message-ID: <20131023124333.356d0e15@ipc1.ka-ro> (raw)
In-Reply-To: <20131023182609.6646b5c0@tom-ThinkPad-T410>

Hi,

Ming Lei wrote:
> On Wed, 23 Oct 2013 11:06:18 +0200
> Lothar Wa?mann <LW@KARO-electronics.de> wrote:
> 
[...]
> > Or is it an unintended side effect of some recent change?
> 
> Maybe yes, could you test below patch?
> 
> Tejun, looks we need to keep special attention on zero size of bin file
> as before, could you comment at the patch?
> 
> --
> diff --git a/fs/sysfs/file.c b/fs/sysfs/file.c
> index 5d818df..366ae8d 100644
> --- a/fs/sysfs/file.c
> +++ b/fs/sysfs/file.c
> @@ -277,7 +277,7 @@ static ssize_t sysfs_write_file(struct file *file, const char __user *user_buf,
>  	ssize_t len = min_t(size_t, count, PAGE_SIZE);
>  	char *buf;
>  
> -	if (sysfs_is_bin(of->sd)) {
> +	if (sysfs_is_bin(of->sd) && size) {
>  		loff_t size = file_inode(file)->i_size;
>  
>  		if (size <= *ppos)
> 
> 
> 
The patch as is produces a build error, because 'size' is only defined
after the 'if' statement.

The modified patch below works for me.

diff --git a/fs/sysfs/file.c b/fs/sysfs/file.c
index 5d818df..709d6f5 100644
--- a/fs/sysfs/file.c
+++ b/fs/sysfs/file.c
@@ -277,7 +277,7 @@ static ssize_t sysfs_write_file(struct file *file, const char __user *user_buf,
 	ssize_t len = min_t(size_t, count, PAGE_SIZE);
 	char *buf;
 
-	if (sysfs_is_bin(of->sd)) {
+	if (sysfs_is_bin(of->sd) && file_inode(file)->i_size) {
 		loff_t size = file_inode(file)->i_size;
 
 		if (size <= *ppos)



Lothar Wa?mann
-- 
___________________________________________________________

Ka-Ro electronics GmbH | Pascalstra?e 22 | D - 52076 Aachen
Phone: +49 2408 1402-0 | Fax: +49 2408 1402-10
Gesch?ftsf?hrer: Matthias Kaussen
Handelsregistereintrag: Amtsgericht Aachen, HRB 4996

www.karo-electronics.de | info@karo-electronics.de
___________________________________________________________

  reply	other threads:[~2013-10-23 10:43 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-23  9:06 userspace firmware load fails with current linux-next Lothar Waßmann
2013-10-23 10:26 ` Ming Lei
2013-10-23 10:43   ` Lothar Waßmann [this message]
2013-10-23 10:48     ` Ming Lei

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=20131023124333.356d0e15@ipc1.ka-ro \
    --to=lw@karo-electronics.de \
    --cc=linux-arm-kernel@lists.infradead.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