Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1338670 > unrolled thread

[PATCH] firmware: set firmware_buf size in kernel_read_file_from_path()

Started bySergey Senozhatsky <sergey.senozhatsky@gmail.com>
First post2016-02-20 10:20 +0100
Last post2016-02-21 22:30 +0100
Articles 6 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] firmware: set firmware_buf size in kernel_read_file_from_path() Sergey Senozhatsky <sergey.senozhatsky@gmail.com> - 2016-02-20 10:20 +0100
    Re: [PATCH] firmware: set firmware_buf size in  kernel_read_file_from_path() Sergey Senozhatsky <sergey.senozhatsky@gmail.com> - 2016-02-20 10:30 +0100
    [PATCH] firmware: set firmware_buf size in fw_get_filesystem_firmware() Sergey Senozhatsky <sergey.senozhatsky@gmail.com> - 2016-02-20 10:30 +0100
      Re: [PATCH] firmware: set firmware_buf size in  fw_get_filesystem_firmware() Sergey Senozhatsky <sergey.senozhatsky@gmail.com> - 2016-02-21 19:50 +0100
        Re: [PATCH] firmware: set firmware_buf size in  fw_get_filesystem_firmware() Mimi Zohar <zohar@linux.vnet.ibm.com> - 2016-02-21 20:00 +0100
      Re: [PATCH] firmware: set firmware_buf size in fw_get_filesystem_firmware() Ming Lei <ming.lei@canonical.com> - 2016-02-21 22:30 +0100

#1338670 — [PATCH] firmware: set firmware_buf size in kernel_read_file_from_path()

FromSergey Senozhatsky <sergey.senozhatsky@gmail.com>
Date2016-02-20 10:20 +0100
Subject[PATCH] firmware: set firmware_buf size in kernel_read_file_from_path()
Message-ID<r4bRL-2PI-7@gated-at.bofh.it>
Set firmware_buf->size in kernel_read_file_from_path(),
otherwise assign_firmware_buf() fails.

Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
---
 drivers/base/firmware_class.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c
index b8bc846..7cf41a5 100644
--- a/drivers/base/firmware_class.c
+++ b/drivers/base/firmware_class.c
@@ -335,6 +335,7 @@ static int fw_get_filesystem_firmware(struct device *device,
 		}
 		dev_dbg(device, "direct-loading %s\n",
 			buf->fw_id);
+		buf->size = size;
 		fw_finish_direct_load(device, buf);
 		break;
 	}
-- 
2.7.1

[toc] | [next] | [standalone]


#1338671 — Re: [PATCH] firmware: set firmware_buf size in kernel_read_file_from_path()

FromSergey Senozhatsky <sergey.senozhatsky@gmail.com>
Date2016-02-20 10:30 +0100
SubjectRe: [PATCH] firmware: set firmware_buf size in kernel_read_file_from_path()
Message-ID<r4c1r-2TI-1@gated-at.bofh.it>
In reply to#1338670
On (02/20/16 18:14), Sergey Senozhatsky wrote:
> Set firmware_buf->size in kernel_read_file_from_path(),
			^^^
ah... sorry, a typo. not "in", but "after".
I'll resend shortly.

	-ss

[toc] | [prev] | [next] | [standalone]


#1338672 — [PATCH] firmware: set firmware_buf size in fw_get_filesystem_firmware()

FromSergey Senozhatsky <sergey.senozhatsky@gmail.com>
Date2016-02-20 10:30 +0100
Subject[PATCH] firmware: set firmware_buf size in fw_get_filesystem_firmware()
Message-ID<r4c1r-2TI-5@gated-at.bofh.it>
In reply to#1338670
Set firmware_buf->size in fw_get_filesystem_firmware() after
successful kernel_read_file_from_path(), otherwise assign_firmware_buf()
fails.

Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
---
 drivers/base/firmware_class.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c
index b8bc846..7cf41a5 100644
--- a/drivers/base/firmware_class.c
+++ b/drivers/base/firmware_class.c
@@ -335,6 +335,7 @@ static int fw_get_filesystem_firmware(struct device *device,
 		}
 		dev_dbg(device, "direct-loading %s\n",
 			buf->fw_id);
+		buf->size = size;
 		fw_finish_direct_load(device, buf);
 		break;
 	}
-- 
2.7.1

[toc] | [prev] | [next] | [standalone]


#1338947 — Re: [PATCH] firmware: set firmware_buf size in fw_get_filesystem_firmware()

FromSergey Senozhatsky <sergey.senozhatsky@gmail.com>
Date2016-02-21 19:50 +0100
SubjectRe: [PATCH] firmware: set firmware_buf size in fw_get_filesystem_firmware()
Message-ID<r4HeV-1KO-3@gated-at.bofh.it>
In reply to#1338672
Hello,

On (02/20/16 22:59), Mimi Zohar wrote:
> On Sat, 2016-02-20 at 18:22 +0900, Sergey Senozhatsky wrote:
> > Set firmware_buf->size in fw_get_filesystem_firmware() after
> > successful kernel_read_file_from_path(), otherwise assign_firmware_buf()
> > fails.
> > 
> > Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
> > ---
> >  drivers/base/firmware_class.c | 1 +
> >  1 file changed, 1 insertion(+)
> > 
> > diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c
> > index b8bc846..7cf41a5 100644
> > --- a/drivers/base/firmware_class.c
> > +++ b/drivers/base/firmware_class.c
> > @@ -335,6 +335,7 @@ static int fw_get_filesystem_firmware(struct device *device,
> >  		}
> >  		dev_dbg(device, "direct-loading %s\n",
> >  			buf->fw_id);
> > +		buf->size = size;
> >  		fw_finish_direct_load(device, buf);
> >  		break;
> >  	}
> 
> Thanks, Sergey. 
> 
> Somehow this was dropped in v4.

sure, no prob.
if there is a way to fold this small fix into the original patch, then I wouldn't
mind at all to go with this option.


The other thing is that, the dmesg output has changed, and now it keeps the
log of unsuccessful ucode accesses from ->ucode_api_max to ->ucode_api_min:

[    1.236866] Unable to open file: /lib/firmware/updates/4.5.0-rc4-mm1-dbg-00407-g2edf49f-dirty/iwlwifi-7260-17.ucode (-2)
[    1.236874] iwlwifi 0000:02:00.0: loading /lib/firmware/updates/4.5.0-rc4-mm1-dbg-00407-g2edf49f-dirty/iwlwifi-7260-17.ucode failed with error -2
[    1.236889] Unable to open file: /lib/firmware/updates/iwlwifi-7260-17.ucode (-2)
[    1.236894] iwlwifi 0000:02:00.0: loading /lib/firmware/updates/iwlwifi-7260-17.ucode failed with error -2
[    1.237064] Unable to open file: /lib/firmware/4.5.0-rc4-mm1-dbg-00407-g2edf49f-dirty/iwlwifi-7260-17.ucode (-2)
[    1.237073] iwlwifi 0000:02:00.0: loading /lib/firmware/4.5.0-rc4-mm1-dbg-00407-g2edf49f-dirty/iwlwifi-7260-17.ucode failed with error -2
[    1.237094] Unable to open file: /lib/firmware/iwlwifi-7260-17.ucode (-2)
[    1.237099] iwlwifi 0000:02:00.0: loading /lib/firmware/iwlwifi-7260-17.ucode failed with error -2
[    1.237106] iwlwifi 0000:02:00.0: Direct firmware load for iwlwifi-7260-17.ucode failed with error -2
[    1.237190] Unable to open file: /lib/firmware/updates/4.5.0-rc4-mm1-dbg-00407-g2edf49f-dirty/iwlwifi-7260-16.ucode (-2)
[    1.237195] iwlwifi 0000:02:00.0: loading /lib/firmware/updates/4.5.0-rc4-mm1-dbg-00407-g2edf49f-dirty/iwlwifi-7260-16.ucode failed with error -2
[    1.237201] Unable to open file: /lib/firmware/updates/iwlwifi-7260-16.ucode (-2)
[    1.237204] iwlwifi 0000:02:00.0: loading /lib/firmware/updates/iwlwifi-7260-16.ucode failed with error -2
[    1.237217] Unable to open file: /lib/firmware/4.5.0-rc4-mm1-dbg-00407-g2edf49f-dirty/iwlwifi-7260-16.ucode (-2)
[    1.237221] iwlwifi 0000:02:00.0: loading /lib/firmware/4.5.0-rc4-mm1-dbg-00407-g2edf49f-dirty/iwlwifi-7260-16.ucode failed with error -2


is this intentional? is there any reason to give this info back to user or
this is just a small regression?

	-ss

[toc] | [prev] | [next] | [standalone]


#1338957 — Re: [PATCH] firmware: set firmware_buf size in fw_get_filesystem_firmware()

FromMimi Zohar <zohar@linux.vnet.ibm.com>
Date2016-02-21 20:00 +0100
SubjectRe: [PATCH] firmware: set firmware_buf size in fw_get_filesystem_firmware()
Message-ID<r4HoC-1OF-27@gated-at.bofh.it>
In reply to#1338947
On Sun, 2016-02-21 at 14:01 +0900, Sergey Senozhatsky wrote:
> Hello,
> 
> On (02/20/16 22:59), Mimi Zohar wrote:
> > On Sat, 2016-02-20 at 18:22 +0900, Sergey Senozhatsky wrote:
> > > Set firmware_buf->size in fw_get_filesystem_firmware() after
> > > successful kernel_read_file_from_path(), otherwise assign_firmware_buf()
> > > fails.
> > > 
> > > Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
> > > ---
> > >  drivers/base/firmware_class.c | 1 +
> > >  1 file changed, 1 insertion(+)
> > > 
> > > diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c
> > > index b8bc846..7cf41a5 100644
> > > --- a/drivers/base/firmware_class.c
> > > +++ b/drivers/base/firmware_class.c
> > > @@ -335,6 +335,7 @@ static int fw_get_filesystem_firmware(struct device *device,
> > >  		}
> > >  		dev_dbg(device, "direct-loading %s\n",
> > >  			buf->fw_id);
> > > +		buf->size = size;
> > >  		fw_finish_direct_load(device, buf);
> > >  		break;
> > >  	}
> > 
> > Thanks, Sergey. 
> > 
> > Somehow this was dropped in v4.
> 
> sure, no prob.
> if there is a way to fold this small fix into the original patch, then I wouldn't
> mind at all to go with this option.

Will do, thanks.
> 
> The other thing is that, the dmesg output has changed, and now it keeps the
> log of unsuccessful ucode accesses from ->ucode_api_max to ->ucode_api_min:
> 
> [    1.236866] Unable to open file: /lib/firmware/updates/4.5.0-rc4-mm1-dbg-00407-g2edf49f-dirty/iwlwifi-7260-17.ucode (-2)
> [    1.236874] iwlwifi 0000:02:00.0: loading /lib/firmware/updates/4.5.0-rc4-mm1-dbg-00407-g2edf49f-dirty/iwlwifi-7260-17.ucode failed with error -2
> [    1.236889] Unable to open file: /lib/firmware/updates/iwlwifi-7260-17.ucode (-2)
> [    1.236894] iwlwifi 0000:02:00.0: loading /lib/firmware/updates/iwlwifi-7260-17.ucode failed with error -2
> [    1.237064] Unable to open file: /lib/firmware/4.5.0-rc4-mm1-dbg-00407-g2edf49f-dirty/iwlwifi-7260-17.ucode (-2)
> [    1.237073] iwlwifi 0000:02:00.0: loading /lib/firmware/4.5.0-rc4-mm1-dbg-00407-g2edf49f-dirty/iwlwifi-7260-17.ucode failed with error -2
> [    1.237094] Unable to open file: /lib/firmware/iwlwifi-7260-17.ucode (-2)
> [    1.237099] iwlwifi 0000:02:00.0: loading /lib/firmware/iwlwifi-7260-17.ucode failed with error -2
> [    1.237106] iwlwifi 0000:02:00.0: Direct firmware load for iwlwifi-7260-17.ucode failed with error -2
> [    1.237190] Unable to open file: /lib/firmware/updates/4.5.0-rc4-mm1-dbg-00407-g2edf49f-dirty/iwlwifi-7260-16.ucode (-2)
> [    1.237195] iwlwifi 0000:02:00.0: loading /lib/firmware/updates/4.5.0-rc4-mm1-dbg-00407-g2edf49f-dirty/iwlwifi-7260-16.ucode failed with error -2
> [    1.237201] Unable to open file: /lib/firmware/updates/iwlwifi-7260-16.ucode (-2)
> [    1.237204] iwlwifi 0000:02:00.0: loading /lib/firmware/updates/iwlwifi-7260-16.ucode failed with error -2
> [    1.237217] Unable to open file: /lib/firmware/4.5.0-rc4-mm1-dbg-00407-g2edf49f-dirty/iwlwifi-7260-16.ucode (-2)
> [    1.237221] iwlwifi 0000:02:00.0: loading /lib/firmware/4.5.0-rc4-mm1-dbg-00407-g2edf49f-dirty/iwlwifi-7260-16.ucode failed with error -2
> 
> 
> is this intentional? is there any reason to give this info back to user or
> this is just a small regression?

Thank you for pointing this out.  The  move from
kernel_read_file_from_fd() to kernel_read_from_path() introduced this
change.  Neither function should display errors.

Mimi

[toc] | [prev] | [next] | [standalone]


#1338985 — Re: [PATCH] firmware: set firmware_buf size in fw_get_filesystem_firmware()

FromMing Lei <ming.lei@canonical.com>
Date2016-02-21 22:30 +0100
SubjectRe: [PATCH] firmware: set firmware_buf size in fw_get_filesystem_firmware()
Message-ID<r4JJM-3Ek-11@gated-at.bofh.it>
In reply to#1338672
On Sat, Feb 20, 2016 at 5:22 PM, Sergey Senozhatsky
<sergey.senozhatsky@gmail.com> wrote:
> Set firmware_buf->size in fw_get_filesystem_firmware() after
> successful kernel_read_file_from_path(), otherwise assign_firmware_buf()
> fails.
>
> Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>

Acked-by: Ming Lei <ming.lei@canonical.com>

This patch fixes d29a7309971afb97b21e7(firmware: replace call
to fw_read_file_contents() with kernel version).

thanks,

> ---
>  drivers/base/firmware_class.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c
> index b8bc846..7cf41a5 100644
> --- a/drivers/base/firmware_class.c
> +++ b/drivers/base/firmware_class.c
> @@ -335,6 +335,7 @@ static int fw_get_filesystem_firmware(struct device *device,
>                 }
>                 dev_dbg(device, "direct-loading %s\n",
>                         buf->fw_id);
> +               buf->size = size;
>                 fw_finish_direct_load(device, buf);
>                 break;
>         }
> --
> 2.7.1
>

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web