linux-staging.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [PATCH] staging: pi433: prevent uninitialized data from being printed out
@ 2022-02-26  4:25 Paulo Miguel Almeida
  2022-02-26 13:08 ` Pavel Skripkin
  0 siblings, 1 reply; 4+ messages in thread
From: Paulo Miguel Almeida @ 2022-02-26  4:25 UTC (permalink / raw)
  To: gregkh, paulo.miguel.almeida.rodenas, realwakka
  Cc: linux-staging, linux-kernel

local_buffer is not initialised before data is passed to
spi_sync_transfer. In case spi* function fails then the dev_dbg
statement after that can potentially print out uninitialised data

this patch initialises local_buffer array.

Signed-off-by: Paulo Miguel Almeida <paulo.miguel.almeida.rodenas@gmail.com>
---
Meta-comments:

- this change was requested by Dan Carpenter in a different thread:
https://lore.kernel.org/lkml/20220207100601.GF1951@kadam/

Patch dependency:

- this patch depends on the following patch to be applied first as
both of them change the same file:
https://lore.kernel.org/lkml/Yhla4a1Clpguoo2h@mail.google.com/
---
 drivers/staging/pi433/rf69.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/pi433/rf69.c b/drivers/staging/pi433/rf69.c
index e5b23ab39c69..3028018f0b45 100644
--- a/drivers/staging/pi433/rf69.c
+++ b/drivers/staging/pi433/rf69.c
@@ -782,7 +782,7 @@ int rf69_read_fifo(struct spi_device *spi, u8 *buffer, unsigned int size)
 {
 	int i;
 	struct spi_transfer transfer;
-	u8 local_buffer[FIFO_SIZE + 1];
+	u8 local_buffer[FIFO_SIZE + 1] = {};
 	int retval;
 
 	if (size > FIFO_SIZE) {
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] staging: pi433: prevent uninitialized data from being printed out
  2022-02-26  4:25 [PATCH] staging: pi433: prevent uninitialized data from being printed out Paulo Miguel Almeida
@ 2022-02-26 13:08 ` Pavel Skripkin
  2022-02-28  6:44   ` Dan Carpenter
  0 siblings, 1 reply; 4+ messages in thread
From: Pavel Skripkin @ 2022-02-26 13:08 UTC (permalink / raw)
  To: Paulo Miguel Almeida, gregkh, realwakka; +Cc: linux-staging, linux-kernel

Hi Paulo Miguel,

On 2/26/22 07:25, Paulo Miguel Almeida wrote:
> local_buffer is not initialised before data is passed to
> spi_sync_transfer. In case spi* function fails then the dev_dbg
> statement after that can potentially print out uninitialised data
> 
> this patch initialises local_buffer array.
> 
> Signed-off-by: Paulo Miguel Almeida <paulo.miguel.almeida.rodenas@gmail.com>

I think, it should have a Fixes: tag.

> ---
> Meta-comments:
> 
> - this change was requested by Dan Carpenter in a different thread:
> https://lore.kernel.org/lkml/20220207100601.GF1951@kadam/
> 

Worth mentioning Dan with Reported-by/Suggested-by: :)

> Patch dependency:
> 
> - this patch depends on the following patch to be applied first as
> both of them change the same file:
> https://lore.kernel.org/lkml/Yhla4a1Clpguoo2h@mail.google.com/
> ---

You can send all these patches as a patch series with proper order. It 
will help maintainers to not break the order while applying.

>   drivers/staging/pi433/rf69.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/pi433/rf69.c b/drivers/staging/pi433/rf69.c
> index e5b23ab39c69..3028018f0b45 100644
> --- a/drivers/staging/pi433/rf69.c
> +++ b/drivers/staging/pi433/rf69.c
> @@ -782,7 +782,7 @@ int rf69_read_fifo(struct spi_device *spi, u8 *buffer, unsigned int size)
>   {
>   	int i;
>   	struct spi_transfer transfer;
> -	u8 local_buffer[FIFO_SIZE + 1];
> +	u8 local_buffer[FIFO_SIZE + 1] = {};
>   	int retval;
>   
>   	if (size > FIFO_SIZE) {




With regards,
Pavel Skripkin

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] staging: pi433: prevent uninitialized data from being printed out
  2022-02-26 13:08 ` Pavel Skripkin
@ 2022-02-28  6:44   ` Dan Carpenter
  2022-03-02  9:02     ` Paulo Miguel Almeida
  0 siblings, 1 reply; 4+ messages in thread
From: Dan Carpenter @ 2022-02-28  6:44 UTC (permalink / raw)
  To: Pavel Skripkin
  Cc: Paulo Miguel Almeida, gregkh, realwakka, linux-staging,
	linux-kernel

On Sat, Feb 26, 2022 at 04:08:48PM +0300, Pavel Skripkin wrote:
> > Patch dependency:
> > 
> > - this patch depends on the following patch to be applied first as
> > both of them change the same file:
> > https://lore.kernel.org/lkml/Yhla4a1Clpguoo2h@mail.google.com/
> > ---
> 
> You can send all these patches as a patch series with proper order. It will
> help maintainers to not break the order while applying.
> 

1) All what Pavel said is true.
2) In this case the order does not matter so this text is confusing and
   unnecessary.
3) Greg is going to see that and he is *never* going to click on that
   link.  In staging then we do not care about the order of patches.
   Everything is applied in first come first serve basis.  If Greg finds
   out that order matters and it is not sent as a patch set then he
   just deletes all your patches and asks you to resend everything
   correctly.

regards,
dan carpenter


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] staging: pi433: prevent uninitialized data from being printed out
  2022-02-28  6:44   ` Dan Carpenter
@ 2022-03-02  9:02     ` Paulo Miguel Almeida
  0 siblings, 0 replies; 4+ messages in thread
From: Paulo Miguel Almeida @ 2022-03-02  9:02 UTC (permalink / raw)
  To: Dan Carpenter, paskripkin
  Cc: Pavel Skripkin, gregkh, realwakka, linux-staging, linux-kernel

On Mon, Feb 28, 2022 at 09:44:15AM +0300, Dan Carpenter wrote:
> On Sat, Feb 26, 2022 at 04:08:48PM +0300, Pavel Skripkin wrote:
> > > Patch dependency:
> > > 
> > > - this patch depends on the following patch to be applied first as
> > > both of them change the same file:
> > > https://lore.kernel.org/lkml/Yhla4a1Clpguoo2h@mail.google.com/
> > > ---
> > 
> > You can send all these patches as a patch series with proper order. It will
> > help maintainers to not break the order while applying.
> > 
> 
> 1) All what Pavel said is true.

Hi Pavel, Hi Dan, 

thanks for taking the time to review my patch (and apologies for taking
this long to reply back to you guys).

This patch ended up being merged yesterday so I will be extra careful
for the next patches I send :)

> 3) Greg is going to see that and he is *never* going to click on that
>    link.  In staging then we do not care about the order of patches.
>    Everything is applied in first come first serve basis.  If Greg finds
>    out that order matters and it is not sent as a patch set then he
>    just deletes all your patches and asks you to resend everything
>    correctly.

Noted.

Best regards,

Paulo Almeida

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-03-02  9:02 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-02-26  4:25 [PATCH] staging: pi433: prevent uninitialized data from being printed out Paulo Miguel Almeida
2022-02-26 13:08 ` Pavel Skripkin
2022-02-28  6:44   ` Dan Carpenter
2022-03-02  9:02     ` Paulo Miguel Almeida

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).