* [PATCH net-next v2] firmware_loader: Expand Firmware upload error codes with firmware invalid error
@ 2023-11-21 10:50 Kory Maincent
2023-11-22 1:30 ` Jakub Kicinski
0 siblings, 1 reply; 5+ messages in thread
From: Kory Maincent @ 2023-11-21 10:50 UTC (permalink / raw)
To: Jakub Kicinski, Luis Chamberlain, Russ Weight, Greg Kroah-Hartman,
Rafael J. Wysocki
Cc: Thomas Petazzoni, linux-kernel, Conor Dooley, Andrew Lunn, netdev,
Kory Maincent
No error code are available to signal an invalid firmware content.
Drivers that can check the firmware content validity can not return this
specific failure to the user-space
Expand the firmware error code with an additional code:
- "firmware invalid" code which can be used when the provided firmware
is invalid
Acked-by: Luis Chamberlain <mcgrof@kernel.org>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kory Maincent <kory.maincent@bootlin.com>
---
This patch was initially submitted as part of a net patch series.
Conor expressed interest in using it in a different subsystem.
https://lore.kernel.org/netdev/20231116-feature_poe-v1-7-be48044bf249@bootlin.com/
Consequently, I extracted it from the series and submitted it separately.
I first tried to send it to driver-core but it seems also not the best
choice:
https://lore.kernel.org/lkml/2023111720-slicer-exes-7d9f@gregkh/
Jakub could you create a stable branch for this patch and share the branch
information? This way other Maintainers can then pull the patch.
---
drivers/base/firmware_loader/sysfs_upload.c | 1 +
include/linux/firmware.h | 2 ++
2 files changed, 3 insertions(+)
diff --git a/drivers/base/firmware_loader/sysfs_upload.c b/drivers/base/firmware_loader/sysfs_upload.c
index a0af8f5f13d8..829270067d16 100644
--- a/drivers/base/firmware_loader/sysfs_upload.c
+++ b/drivers/base/firmware_loader/sysfs_upload.c
@@ -27,6 +27,7 @@ static const char * const fw_upload_err_str[] = {
[FW_UPLOAD_ERR_INVALID_SIZE] = "invalid-file-size",
[FW_UPLOAD_ERR_RW_ERROR] = "read-write-error",
[FW_UPLOAD_ERR_WEAROUT] = "flash-wearout",
+ [FW_UPLOAD_ERR_FW_INVALID] = "firmware-invalid",
};
static const char *fw_upload_progress(struct device *dev,
diff --git a/include/linux/firmware.h b/include/linux/firmware.h
index de7fea3bca51..0311858b46ce 100644
--- a/include/linux/firmware.h
+++ b/include/linux/firmware.h
@@ -27,6 +27,7 @@ struct firmware {
* @FW_UPLOAD_ERR_INVALID_SIZE: invalid firmware image size
* @FW_UPLOAD_ERR_RW_ERROR: read or write to HW failed, see kernel log
* @FW_UPLOAD_ERR_WEAROUT: FLASH device is approaching wear-out, wait & retry
+ * @FW_UPLOAD_ERR_FW_INVALID: invalid firmware file
* @FW_UPLOAD_ERR_MAX: Maximum error code marker
*/
enum fw_upload_err {
@@ -38,6 +39,7 @@ enum fw_upload_err {
FW_UPLOAD_ERR_INVALID_SIZE,
FW_UPLOAD_ERR_RW_ERROR,
FW_UPLOAD_ERR_WEAROUT,
+ FW_UPLOAD_ERR_FW_INVALID,
FW_UPLOAD_ERR_MAX
};
---
base-commit: b85ea95d086471afb4ad062012a4d73cd328fa86
change-id: 20231117-feature_firmware_error_code-b8d7af08a8fe
Best regards,
--
Köry Maincent, Bootlin
Embedded Linux and kernel engineering
https://bootlin.com
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH net-next v2] firmware_loader: Expand Firmware upload error codes with firmware invalid error
2023-11-21 10:50 [PATCH net-next v2] firmware_loader: Expand Firmware upload error codes with firmware invalid error Kory Maincent
@ 2023-11-22 1:30 ` Jakub Kicinski
2023-11-22 9:16 ` Köry Maincent
2023-11-22 10:43 ` Köry Maincent
0 siblings, 2 replies; 5+ messages in thread
From: Jakub Kicinski @ 2023-11-22 1:30 UTC (permalink / raw)
To: Kory Maincent
Cc: Luis Chamberlain, Russ Weight, Greg Kroah-Hartman,
Rafael J. Wysocki, Thomas Petazzoni, linux-kernel, Conor Dooley,
Andrew Lunn, netdev
On Tue, 21 Nov 2023 11:50:35 +0100 Kory Maincent wrote:
> No error code are available to signal an invalid firmware content.
> Drivers that can check the firmware content validity can not return this
> specific failure to the user-space
>
> Expand the firmware error code with an additional code:
> - "firmware invalid" code which can be used when the provided firmware
> is invalid
Any idea what this is?
lib/test_firmware.o: warning: objtool: test_fw_upload_prepare() falls through to next function __cfi_test_fw_upload_cancel()
My build shows this on an incremental clang 17 build.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net-next v2] firmware_loader: Expand Firmware upload error codes with firmware invalid error
2023-11-22 1:30 ` Jakub Kicinski
@ 2023-11-22 9:16 ` Köry Maincent
2023-11-22 10:43 ` Köry Maincent
1 sibling, 0 replies; 5+ messages in thread
From: Köry Maincent @ 2023-11-22 9:16 UTC (permalink / raw)
To: Jakub Kicinski
Cc: Luis Chamberlain, Russ Weight, Greg Kroah-Hartman,
Rafael J. Wysocki, Thomas Petazzoni, linux-kernel, Conor Dooley,
Andrew Lunn, netdev
Hello Jakub,
On Tue, 21 Nov 2023 17:30:22 -0800
Jakub Kicinski <kuba@kernel.org> wrote:
> On Tue, 21 Nov 2023 11:50:35 +0100 Kory Maincent wrote:
> > No error code are available to signal an invalid firmware content.
> > Drivers that can check the firmware content validity can not return this
> > specific failure to the user-space
> >
> > Expand the firmware error code with an additional code:
> > - "firmware invalid" code which can be used when the provided firmware
> > is invalid
>
> Any idea what this is?
>
> lib/test_firmware.o: warning: objtool: test_fw_upload_prepare() falls through
> to next function __cfi_test_fw_upload_cancel()
>
> My build shows this on an incremental clang 17 build.
Thanks for the report.
It seems I have to update fw_upload_err_str accordingly.
Didn't know about this test_firmware.c file.
Regards,
--
Köry Maincent, Bootlin
Embedded Linux and kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net-next v2] firmware_loader: Expand Firmware upload error codes with firmware invalid error
2023-11-22 1:30 ` Jakub Kicinski
2023-11-22 9:16 ` Köry Maincent
@ 2023-11-22 10:43 ` Köry Maincent
2023-11-24 16:44 ` Simon Horman
1 sibling, 1 reply; 5+ messages in thread
From: Köry Maincent @ 2023-11-22 10:43 UTC (permalink / raw)
To: Jakub Kicinski
Cc: Luis Chamberlain, Russ Weight, Greg Kroah-Hartman,
Rafael J. Wysocki, Thomas Petazzoni, linux-kernel, Conor Dooley,
Andrew Lunn, netdev
On Tue, 21 Nov 2023 17:30:22 -0800
Jakub Kicinski <kuba@kernel.org> wrote:
> On Tue, 21 Nov 2023 11:50:35 +0100 Kory Maincent wrote:
> > No error code are available to signal an invalid firmware content.
> > Drivers that can check the firmware content validity can not return this
> > specific failure to the user-space
> >
> > Expand the firmware error code with an additional code:
> > - "firmware invalid" code which can be used when the provided firmware
> > is invalid
>
> Any idea what this is?
>
> lib/test_firmware.o: warning: objtool: test_fw_upload_prepare() falls through
> to next function __cfi_test_fw_upload_cancel()
>
> My build shows this on an incremental clang 17 build.
For my curiosity, how do you get this error?
Enabling test_firmware and building with W=1 does not show the error.
Regards,
--
Köry Maincent, Bootlin
Embedded Linux and kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net-next v2] firmware_loader: Expand Firmware upload error codes with firmware invalid error
2023-11-22 10:43 ` Köry Maincent
@ 2023-11-24 16:44 ` Simon Horman
0 siblings, 0 replies; 5+ messages in thread
From: Simon Horman @ 2023-11-24 16:44 UTC (permalink / raw)
To: Köry Maincent
Cc: Jakub Kicinski, Luis Chamberlain, Russ Weight, Greg Kroah-Hartman,
Rafael J. Wysocki, Thomas Petazzoni, linux-kernel, Conor Dooley,
Andrew Lunn, netdev
On Wed, Nov 22, 2023 at 11:43:25AM +0100, Köry Maincent wrote:
> On Tue, 21 Nov 2023 17:30:22 -0800
> Jakub Kicinski <kuba@kernel.org> wrote:
>
> > On Tue, 21 Nov 2023 11:50:35 +0100 Kory Maincent wrote:
> > > No error code are available to signal an invalid firmware content.
> > > Drivers that can check the firmware content validity can not return this
> > > specific failure to the user-space
> > >
> > > Expand the firmware error code with an additional code:
> > > - "firmware invalid" code which can be used when the provided firmware
> > > is invalid
> >
> > Any idea what this is?
> >
> > lib/test_firmware.o: warning: objtool: test_fw_upload_prepare() falls through
> > to next function __cfi_test_fw_upload_cancel()
> >
> > My build shows this on an incremental clang 17 build.
>
> For my curiosity, how do you get this error?
>
> Enabling test_firmware and building with W=1 does not show the error.
Hi Kory,
I am able to observe this warning when compiling with clang-16
make LLVM=1 lib/test_firmware.o
...
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-11-24 16:44 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-21 10:50 [PATCH net-next v2] firmware_loader: Expand Firmware upload error codes with firmware invalid error Kory Maincent
2023-11-22 1:30 ` Jakub Kicinski
2023-11-22 9:16 ` Köry Maincent
2023-11-22 10:43 ` Köry Maincent
2023-11-24 16:44 ` Simon Horman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).