* [PATCH 0/2] Input: ims-pcu - annotate struct ims_pcu_flash_fmt with __counted_by
@ 2024-06-19 21:13 Javier Carrasco
2024-06-19 21:13 ` [PATCH 1/2] " Javier Carrasco
2024-06-19 21:13 ` [PATCH 2/2] Input: ims-pcu - drop repeated "input" in error message Javier Carrasco
0 siblings, 2 replies; 8+ messages in thread
From: Javier Carrasco @ 2024-06-19 21:13 UTC (permalink / raw)
To: Dmitry Torokhov, Kees Cook, Gustavo A. R. Silva
Cc: linux-input, linux-kernel, linux-hardening, Javier Carrasco
The length is assigned before the first reference to the data flexible
array (see ims_pcu_flash_firmware()), which allows for a straightforward
annotation without further modifications.
When at it, I also fixed an error message that repeats the word "input".
Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
---
Javier Carrasco (2):
Input: ims-pcu - annotate struct ims_pcu_flash_fmt with __counted_by
Input: ims-pcu - drop repeated "input" in error message
drivers/input/misc/ims-pcu.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
---
base-commit: 2102cb0d050d34d50b9642a3a50861787527e922
change-id: 20240619-ims-pcu-counted_by-7ff24a731073
Best regards,
--
Javier Carrasco <javier.carrasco.cruz@gmail.com>
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 1/2] Input: ims-pcu - annotate struct ims_pcu_flash_fmt with __counted_by
2024-06-19 21:13 [PATCH 0/2] Input: ims-pcu - annotate struct ims_pcu_flash_fmt with __counted_by Javier Carrasco
@ 2024-06-19 21:13 ` Javier Carrasco
2024-06-19 21:19 ` Kees Cook
` (2 more replies)
2024-06-19 21:13 ` [PATCH 2/2] Input: ims-pcu - drop repeated "input" in error message Javier Carrasco
1 sibling, 3 replies; 8+ messages in thread
From: Javier Carrasco @ 2024-06-19 21:13 UTC (permalink / raw)
To: Dmitry Torokhov, Kees Cook, Gustavo A. R. Silva
Cc: linux-input, linux-kernel, linux-hardening, Javier Carrasco
Use the __counted_by compiler attribute for the data[] flexible array
member to improve the results of array bound sanitizers.
Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
---
drivers/input/misc/ims-pcu.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/input/misc/ims-pcu.c b/drivers/input/misc/ims-pcu.c
index 408a586f8c36..91f8ad826238 100644
--- a/drivers/input/misc/ims-pcu.c
+++ b/drivers/input/misc/ims-pcu.c
@@ -761,7 +761,7 @@ static int ims_pcu_switch_to_bootloader(struct ims_pcu *pcu)
struct ims_pcu_flash_fmt {
__le32 addr;
u8 len;
- u8 data[];
+ u8 data[] __counted_by(len);
};
static unsigned int ims_pcu_count_fw_records(const struct firmware *fw)
--
2.40.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 2/2] Input: ims-pcu - drop repeated "input" in error message
2024-06-19 21:13 [PATCH 0/2] Input: ims-pcu - annotate struct ims_pcu_flash_fmt with __counted_by Javier Carrasco
2024-06-19 21:13 ` [PATCH 1/2] " Javier Carrasco
@ 2024-06-19 21:13 ` Javier Carrasco
2024-06-19 21:19 ` Kees Cook
2024-06-20 21:58 ` Dmitry Torokhov
1 sibling, 2 replies; 8+ messages in thread
From: Javier Carrasco @ 2024-06-19 21:13 UTC (permalink / raw)
To: Dmitry Torokhov, Kees Cook, Gustavo A. R. Silva
Cc: linux-input, linux-kernel, linux-hardening, Javier Carrasco
This case of the common error message upon failure of
input_allocate_device() repeats the word "input".
Drop one "input" from the error message.
Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
---
drivers/input/misc/ims-pcu.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/input/misc/ims-pcu.c b/drivers/input/misc/ims-pcu.c
index 91f8ad826238..a8c474de01ad 100644
--- a/drivers/input/misc/ims-pcu.c
+++ b/drivers/input/misc/ims-pcu.c
@@ -207,8 +207,7 @@ static int ims_pcu_setup_buttons(struct ims_pcu *pcu,
input = input_allocate_device();
if (!input) {
- dev_err(pcu->dev,
- "Not enough memory for input input device\n");
+ dev_err(pcu->dev, "Not enough memory for input device\n");
return -ENOMEM;
}
--
2.40.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] Input: ims-pcu - annotate struct ims_pcu_flash_fmt with __counted_by
2024-06-19 21:13 ` [PATCH 1/2] " Javier Carrasco
@ 2024-06-19 21:19 ` Kees Cook
2024-06-19 21:26 ` Gustavo A. R. Silva
2024-06-20 21:57 ` Dmitry Torokhov
2 siblings, 0 replies; 8+ messages in thread
From: Kees Cook @ 2024-06-19 21:19 UTC (permalink / raw)
To: Javier Carrasco
Cc: Dmitry Torokhov, Gustavo A. R. Silva, linux-input, linux-kernel,
linux-hardening
On Wed, Jun 19, 2024 at 11:13:21PM +0200, Javier Carrasco wrote:
> Use the __counted_by compiler attribute for the data[] flexible array
> member to improve the results of array bound sanitizers.
>
> Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Looks good to me. Thanks!
Reviewed-by: Kees Cook <kees@kernel.org>
--
Kees Cook
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2/2] Input: ims-pcu - drop repeated "input" in error message
2024-06-19 21:13 ` [PATCH 2/2] Input: ims-pcu - drop repeated "input" in error message Javier Carrasco
@ 2024-06-19 21:19 ` Kees Cook
2024-06-20 21:58 ` Dmitry Torokhov
1 sibling, 0 replies; 8+ messages in thread
From: Kees Cook @ 2024-06-19 21:19 UTC (permalink / raw)
To: Javier Carrasco
Cc: Dmitry Torokhov, Gustavo A. R. Silva, linux-input, linux-kernel,
linux-hardening
On Wed, Jun 19, 2024 at 11:13:22PM +0200, Javier Carrasco wrote:
> This case of the common error message upon failure of
> input_allocate_device() repeats the word "input".
>
> Drop one "input" from the error message.
>
> Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Reviewed-by: Kees Cook <kees@kernel.org>
--
Kees Cook
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] Input: ims-pcu - annotate struct ims_pcu_flash_fmt with __counted_by
2024-06-19 21:13 ` [PATCH 1/2] " Javier Carrasco
2024-06-19 21:19 ` Kees Cook
@ 2024-06-19 21:26 ` Gustavo A. R. Silva
2024-06-20 21:57 ` Dmitry Torokhov
2 siblings, 0 replies; 8+ messages in thread
From: Gustavo A. R. Silva @ 2024-06-19 21:26 UTC (permalink / raw)
To: Javier Carrasco, Dmitry Torokhov, Kees Cook, Gustavo A. R. Silva
Cc: linux-input, linux-kernel, linux-hardening
On 19/06/24 23:13, Javier Carrasco wrote:
> Use the __counted_by compiler attribute for the data[] flexible array
> member to improve the results of array bound sanitizers.
>
> Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Thanks
--
Gustavo
> ---
> drivers/input/misc/ims-pcu.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/input/misc/ims-pcu.c b/drivers/input/misc/ims-pcu.c
> index 408a586f8c36..91f8ad826238 100644
> --- a/drivers/input/misc/ims-pcu.c
> +++ b/drivers/input/misc/ims-pcu.c
> @@ -761,7 +761,7 @@ static int ims_pcu_switch_to_bootloader(struct ims_pcu *pcu)
> struct ims_pcu_flash_fmt {
> __le32 addr;
> u8 len;
> - u8 data[];
> + u8 data[] __counted_by(len);
> };
>
> static unsigned int ims_pcu_count_fw_records(const struct firmware *fw)
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] Input: ims-pcu - annotate struct ims_pcu_flash_fmt with __counted_by
2024-06-19 21:13 ` [PATCH 1/2] " Javier Carrasco
2024-06-19 21:19 ` Kees Cook
2024-06-19 21:26 ` Gustavo A. R. Silva
@ 2024-06-20 21:57 ` Dmitry Torokhov
2 siblings, 0 replies; 8+ messages in thread
From: Dmitry Torokhov @ 2024-06-20 21:57 UTC (permalink / raw)
To: Javier Carrasco
Cc: Kees Cook, Gustavo A. R. Silva, linux-input, linux-kernel,
linux-hardening
On Wed, Jun 19, 2024 at 11:13:21PM +0200, Javier Carrasco wrote:
> Use the __counted_by compiler attribute for the data[] flexible array
> member to improve the results of array bound sanitizers.
>
> Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Applied, thank you.
--
Dmitry
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2/2] Input: ims-pcu - drop repeated "input" in error message
2024-06-19 21:13 ` [PATCH 2/2] Input: ims-pcu - drop repeated "input" in error message Javier Carrasco
2024-06-19 21:19 ` Kees Cook
@ 2024-06-20 21:58 ` Dmitry Torokhov
1 sibling, 0 replies; 8+ messages in thread
From: Dmitry Torokhov @ 2024-06-20 21:58 UTC (permalink / raw)
To: Javier Carrasco
Cc: Kees Cook, Gustavo A. R. Silva, linux-input, linux-kernel,
linux-hardening
On Wed, Jun 19, 2024 at 11:13:22PM +0200, Javier Carrasco wrote:
> This case of the common error message upon failure of
> input_allocate_device() repeats the word "input".
>
> Drop one "input" from the error message.
>
> Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Applied, thank you.
--
Dmitry
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2024-06-20 21:58 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-19 21:13 [PATCH 0/2] Input: ims-pcu - annotate struct ims_pcu_flash_fmt with __counted_by Javier Carrasco
2024-06-19 21:13 ` [PATCH 1/2] " Javier Carrasco
2024-06-19 21:19 ` Kees Cook
2024-06-19 21:26 ` Gustavo A. R. Silva
2024-06-20 21:57 ` Dmitry Torokhov
2024-06-19 21:13 ` [PATCH 2/2] Input: ims-pcu - drop repeated "input" in error message Javier Carrasco
2024-06-19 21:19 ` Kees Cook
2024-06-20 21:58 ` Dmitry Torokhov
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).