Re: [PATCH] drm/i915: Prefer struct_size over open coded arithmetic

2021-10-30 Thread Len Baker
Hi, On Wed, Oct 27, 2021 at 06:06:28PM +0300, Jani Nikula wrote: > On Sat, 23 Oct 2021, Len Baker wrote: > > Sorry, but I'm missing something here. In linux-next this is the commit > > history of include/linux/stddef.h file: > > > > 3080ea5553cc stddef: Intro

Re: [PATCH] drm/i915: Prefer struct_size over open coded arithmetic

2021-10-23 Thread Len Baker
Hi Jani, On Mon, Oct 18, 2021 at 01:00:01PM +0300, Jani Nikula wrote: > On Sat, 16 Oct 2021, Len Baker wrote: > > Hi Daniel and Jani, > > > > On Wed, Oct 13, 2021 at 01:51:30PM +0200, Daniel Vetter wrote: > >> On Wed, Oct 13, 2021 at 02:24:05PM +0300, Jani Nikul

Re: [PATCH] drm/i915: Prefer struct_size over open coded arithmetic

2021-10-16 Thread Len Baker
Hi Daniel and Jani, On Wed, Oct 13, 2021 at 01:51:30PM +0200, Daniel Vetter wrote: > On Wed, Oct 13, 2021 at 02:24:05PM +0300, Jani Nikula wrote: > > On Mon, 11 Oct 2021, Len Baker wrote: > > > Hi, > > > > > > On Sun, Oct 03, 2021 at 12:42:58PM +0200, Len

Re: [PATCH] drm/i915: Prefer struct_size over open coded arithmetic

2021-10-11 Thread Len Baker
Hi, On Sun, Oct 03, 2021 at 12:42:58PM +0200, Len Baker wrote: > As noted in the "Deprecated Interfaces, Language Features, Attributes, > and Conventions" documentation [1], size calculations (especially > multiplication) should not be performed in memory allocator (or

[PATCH] drm/i915: Prefer struct_size over open coded arithmetic

2021-10-03 Thread Len Baker
nd audited and fixed manually. [1] https://www.kernel.org/doc/html/latest/process/deprecated.html#open-coded-arithmetic-in-allocator-arguments Signed-off-by: Len Baker --- drivers/gpu/drm/i915/i915_syncmap.c | 12 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/

Re: [PATCH] net: mana: Prefer struct_size over open coded arithmetic

2021-09-19 Thread Len Baker
Hi Dexuan, On Sat, Sep 18, 2021 at 05:06:16PM +, Dexuan Cui wrote: > > From: Len Baker > > Sent: Saturday, September 18, 2021 6:20 AM > > ... > > I have received a email from the linux-media subsystem telling that this > > patch is not applicable. The email is

Re: [PATCH] net: mana: Prefer struct_size over open coded arithmetic

2021-09-18 Thread Len Baker
Hi Kees, On Sat, Sep 18, 2021 at 06:51:51AM -0700, Kees Cook wrote: > > > On September 18, 2021 6:20:10 AM PDT, Len Baker wrote: > >Hi, > > > >On Sat, Sep 11, 2021 at 12:28:18PM +0200, Len Baker wrote: > >> As noted in the "Deprecated Interfaces

Re: [PATCH] net: mana: Prefer struct_size over open coded arithmetic

2021-09-18 Thread Len Baker
Hi, On Sat, Sep 11, 2021 at 12:28:18PM +0200, Len Baker wrote: > As noted in the "Deprecated Interfaces, Language Features, Attributes, > and Conventions" documentation [1], size calculations (especially > multiplication) should not be performed in memory allocator (or

[PATCH] net: mana: Prefer struct_size over open coded arithmetic

2021-09-11 Thread Len Baker
e kzalloc() function. [1] https://www.kernel.org/doc/html/v5.14/process/deprecated.html#open-coded-arithmetic-in-allocator-arguments Signed-off-by: Len Baker --- drivers/net/ethernet/microsoft/mana/hw_channel.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/net/eth

[PATCH] drm/radeon: Prefer kcalloc over open coded arithmetic

2021-09-04 Thread Len Baker
ent in the kzalloc() function. [1] https://www.kernel.org/doc/html/v5.14/process/deprecated.html#open-coded-arithmetic-in-allocator-arguments Signed-off-by: Len Baker --- drivers/gpu/drm/radeon/r600_dpm.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/radeon/

Re: [PATCH v3 0/3] Remove all strcpy() uses

2021-08-01 Thread Len Baker
Hi Andy, On Sun, Aug 01, 2021 at 02:40:40PM +0300, Andy Shevchenko wrote: > On Sun, Aug 1, 2021 at 11:53 AM Len Baker wrote: > > > > strcpy() performs no bounds checking on the destination buffer. This > > could result in linear overflows beyond the end of the buffer, leadin

[PATCH v3 3/3] staging/fbtft: Fix braces coding style

2021-08-01 Thread Len Baker
Add braces to the "for" loop. This way, the kernel coding style is followed. Signed-off-by: Len Baker --- drivers/staging/fbtft/fbtft-core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/staging/fbtft/fbtft-core.c b/drivers/staging/fbtft/fbtft-co

[PATCH v3 2/3] staging/fbtft: Remove unnecessary variable initialization

2021-08-01 Thread Len Baker
Remove the initialization of the variable "i" since it is written a few lines later. Signed-off-by: Len Baker --- drivers/staging/fbtft/fbtft-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/fbtft/fbtft-core.c b/drivers/staging/fbtft/fbtft-co

[PATCH v3 1/3] staging/fbtft: Remove all strcpy() uses

2021-08-01 Thread Len Baker
he "0x%02X " in the sprintf followed by the strcat, the msg buffer (now removed) can print 128/5 values (25 hex values). So, the "%*ph" replacement won't cut output earlier than requested since this format specifier can print up to 64 bytes. Signed-off-by: Len Baker ---

[PATCH v3 0/3] Remove all strcpy() uses

2021-08-01 Thread Len Baker
quot; variable in the "for" loop and update the code accordingly (Andy Shevchenko). - Improve the commit message to inform that the "%*ph" replacement won't cut output earlier than requested (Andy Shevchenko). - Don't remove the braces in the "if" statem

Re: [PATCH v2 1/3] staging/fbtft: Remove all strcpy() uses

2021-07-31 Thread Len Baker
On Sun, Jul 25, 2021 at 09:51:18PM +0300, Andy Shevchenko wrote: > On Sun, Jul 25, 2021 at 4:59 PM Len Baker wrote: > > On Sat, Jul 24, 2021 at 11:21:04PM +0300, Andy Shevchenko wrote: > > > On Sat, Jul 24, 2021 at 7:05 PM Len Baker wrote: > > ... > > > > >

Re: [PATCH v2 3/3] staging/fbtft: Fix braces coding style

2021-07-25 Thread Len Baker
Hi, On Sat, Jul 24, 2021 at 08:01:53PM +0200, Geert Uytterhoeven wrote: > Hi Len, > > On Sat, Jul 24, 2021 at 7:44 PM Len Baker wrote: > > Add braces to the "for" loop and remove braces from the "if" statement. > > This way the kernel coding style is f

Re: [PATCH v2 1/3] staging/fbtft: Remove all strcpy() uses

2021-07-25 Thread Len Baker
Hi, On Sat, Jul 24, 2021 at 11:21:04PM +0300, Andy Shevchenko wrote: > On Sat, Jul 24, 2021 at 7:05 PM Len Baker wrote: > > > > strcpy() performs no bounds checking on the destination buffer. This > > could result in linear overflows beyond the end of the buffer, leadin

[PATCH v2 3/3] staging/fbtft: Fix braces coding style

2021-07-24 Thread Len Baker
Add braces to the "for" loop and remove braces from the "if" statement. This way the kernel coding style is followed. Signed-off-by: Len Baker --- drivers/staging/fbtft/fbtft-core.c | 11 ++- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers

[PATCH v2 2/3] staging/fbtft: Remove unnecessary variable initialization

2021-07-24 Thread Len Baker
Remove the initialization of the variable "i" since it is written a few lines later. Signed-off-by: Len Baker --- drivers/staging/fbtft/fbtft-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/fbtft/fbtft-core.c b/drivers/staging/fbtft/fbtft-co

[PATCH v2 1/3] staging/fbtft: Remove all strcpy() uses

2021-07-24 Thread Len Baker
strcpy() performs no bounds checking on the destination buffer. This could result in linear overflows beyond the end of the buffer, leading to all kinds of misbehaviors. The safe replacement is strscpy() but in this case it is simpler to use the "%*ph" format specifier. Signed-off-by:

[PATCH v2 0/3] Remove all strcpy() uses

2021-07-24 Thread Len Baker
the kernel coding-style and avoid unnecessary variable initialization. Changelog v1 -> v2 - Add two new commits to clean the code. - Use the "%*ph" format specifier instead of strscpy() function (Geert Uytterhoeven) Len Baker (3): staging/fbtft: Remove all strcpy() uses staging/fb

Re: [PATCH] staging/fbtft: Remove all strcpy() uses

2021-07-24 Thread Len Baker
On Mon, Jul 19, 2021 at 09:53:29AM +0200, Geert Uytterhoeven wrote: > On Sun, Jul 18, 2021 at 9:43 PM Andy Shevchenko > wrote: > > On Sun, Jul 18, 2021 at 4:43 PM Len Baker wrote: > > > strcpy() performs no bounds checking on the destination buffer. This > > > co

Re: [PATCH] staging/fbtft: Remove all strcpy() uses

2021-07-24 Thread Len Baker
Hi, On Sun, Jul 18, 2021 at 10:42:42PM +0300, Andy Shevchenko wrote: > On Sun, Jul 18, 2021 at 4:43 PM Len Baker wrote: > > > > strcpy() performs no bounds checking on the destination buffer. This > > could result in linear overflows beyond the end of the buffer, leadin

[PATCH] staging/fbtft: Remove all strcpy() uses

2021-07-18 Thread Len Baker
string. This is a previous step in the path to remove the strcpy() function. Signed-off-by: Len Baker --- drivers/staging/fbtft/fbtft-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/fbtft/fbtft-core.c b/drivers/staging/fbtft/fbtft-core.c index

Re: [PATCH] drm/amd/display: Fix identical code for different branches

2021-07-16 Thread Len Baker
On Sun, Jul 11, 2021 at 10:45:48AM -0700, Joe Perches wrote: > On Sun, 2021-07-11 at 19:24 +0200, Len Baker wrote: > > The branches of the "if" statement are the same. So remove the > > unnecessary if and goto statements. > > > > Addresses-Coverity-ID: 1

[PATCH] drm/amd/display: Fix identical code for different branches

2021-07-11 Thread Len Baker
The branches of the "if" statement are the same. So remove the unnecessary if and goto statements. Addresses-Coverity-ID: 1456916 ("Identical code for different branches") Fixes: 4c283fdac08ab ("drm/amd/display: Add HDCP module") Signed-off-by: Len Baker --- drive

[PATCH] drm/amd/display: Fix identical code for different branches

2021-07-11 Thread Len Baker
Implement VSIF V3 extended refresh rate feature") Signed-off-by: Len Baker --- drivers/gpu/drm/amd/display/modules/freesync/freesync.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/amd/display/modules/freesync/freesync.c b/drivers/gpu/drm/amd/display/modu