[PATCH v2] mfd: omap-usb-tll: use struct_size to allocate tll

2024-06-26 Thread Javier Carrasco
l.org/all/202406261121.2FFD65647@keescook/ [1] Fixes: 16c2004d9e4d ("mfd: omap-usb-tll: Allocate driver data at once") Reviewed-by: Kees Cook Signed-off-by: Javier Carrasco --- Changes in v2: - Patch 1/2: drop (applied). - Patch 2/2: turn into fix. - Link to v1: https://lore.kernel.o

Re: [PATCH 2/2] mfd: omap-usb-tll: use struct_size to allocate tll

2024-06-26 Thread Javier Carrasco
On 26/06/2024 20:43, Kees Cook wrote: > On Thu, Jun 20, 2024 at 11:22:34PM +0200, Javier Carrasco wrote: >> Use the struct_size macro to calculate the size of the tll, which >> includes a trailing flexible array. >> >> Signed-off-by: Javier Carrasco >> >>

Re: [PATCH 2/2] mfd: omap-usb-tll: use struct_size to allocate tll

2024-06-26 Thread Javier Carrasco
On 26/06/2024 17:26, Lee Jones wrote: > On Thu, 20 Jun 2024, Javier Carrasco wrote: > >> Use the struct_size macro to calculate the size of the tll, which >> includes a trailing flexible array. >> >> Signed-off-by: Javier Carrasco >> >> --- >> The

[PATCH 2/2] mfd: omap-usb-tll: use struct_size to allocate tll

2024-06-20 Thread Javier Carrasco
Use the struct_size macro to calculate the size of the tll, which includes a trailing flexible array. Signed-off-by: Javier Carrasco --- The memory allocation used to be carried out in two steps: tll = devm_kzalloc(dev, sizeof(struct usbtll_omap), GFP_KERNEL); tll->ch_clk = devm_kzalloc(

[PATCH 1/2] mfd: omap-usb-tll: annotate struct usbtll_omap with __counted_by

2024-06-20 Thread Javier Carrasco
Use the __counted_by compiler attribute for the "struct clk *ch_clk[]" flexible array member to improve the results of array bound sanitizers. The comments for the variables are no longer needed as it is now clear what is what. Signed-off-by: Javier Carrasco --- drivers/mfd/omap-usb

[PATCH 0/2] mfd: omap-usb-tll: annotate struct usbtll_omap with __counted_by

2024-06-20 Thread Javier Carrasco
The first patch carries out a straightforward annotation, given that the number of channels is initialized before any reference to the flexible array. I might need some feedback on the second patch. I added a comment regarding the issue to provide clarification. Signed-off-by: Javier Carrasco

[PATCH 2/2] Input: ims-pcu - drop repeated "input" in error message

2024-06-19 Thread 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 --- drivers/input/misc/ims-pcu.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff -

[PATCH 1/2] Input: ims-pcu - annotate struct ims_pcu_flash_fmt with __counted_by

2024-06-19 Thread 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 --- drivers/input/misc/ims-pcu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/input/misc/ims-pcu.c b

[PATCH 0/2] Input: ims-pcu - annotate struct ims_pcu_flash_fmt with __counted_by

2024-06-19 Thread 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: Javie

[PATCH v2 2/2] USB: serial: garmin_gps: use struct_size to allocate pkt

2024-06-19 Thread Javier Carrasco
Use the struct_size macro to calculate the size of the pkt, which includes a trailing flexible array. Suggested-by: Nathan Chancellor Signed-off-by: Javier Carrasco --- drivers/usb/serial/garmin_gps.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/usb/serial

[PATCH v2 1/2] USB: serial: garmin_gps: annotate struct garmin_packet with __counted_by

2024-06-19 Thread Javier Carrasco
Use the __counted_by compiler attribute for the data[] flexible array member to improve the results of array bound sanitizers. Reviewed-by: Nathan Chancellor Signed-off-by: Javier Carrasco --- drivers/usb/serial/garmin_gps.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a

[PATCH v2 0/2] USB: serial: garmin_gps: annotate struct garmin_packet with __counted_by

2024-06-19 Thread Javier Carrasco
The size is assigned before the first reference to the flexible array (see pkt_add()), which allows for a straightforward annotation without further modifications. Signed-off-by: Javier Carrasco --- Changes in v2: - Use struct_size to calculate the size of pkt. - Link to v1: https

Re: [PATCH] USB: serial: garmin_gps: annotate struct garmin_packet with __counted_by

2024-06-19 Thread Javier Carrasco
On 19/06/2024 16:43, Nathan Chancellor wrote: > On Wed, Jun 19, 2024 at 11:40:57AM +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: Jav

[PATCH] USB: serial: garmin_gps: annotate struct garmin_packet with __counted_by

2024-06-19 Thread 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 --- The size is assigned before the first reference to the flexible array (see pkt_add()), which allows for a straightforward annotation