All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Documentation/rs485: Fix missing zero init on sample code
@ 2017-11-06 10:51 Ricardo Ribalda Delgado
  2017-11-07 13:28 ` Jiri Slaby
  0 siblings, 1 reply; 3+ messages in thread
From: Ricardo Ribalda Delgado @ 2017-11-06 10:51 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby, Jonathan Corbet, linux-doc, linux-kernel
  Cc: Ricardo Ribalda Delgado

The sample code does not initialize to zero a local variable and then it
uses the uninitialized code.

Fix in case someone copy/paste the sample code.

Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
---
 Documentation/serial/serial-rs485.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Documentation/serial/serial-rs485.txt b/Documentation/serial/serial-rs485.txt
index 389fcd4759e9..2bbae93bf279 100644
--- a/Documentation/serial/serial-rs485.txt
+++ b/Documentation/serial/serial-rs485.txt
@@ -54,7 +54,7 @@
 		/* Error handling. See errno. */
 	}
 
-	struct serial_rs485 rs485conf;
+	struct serial_rs485 rs485conf = {};
 
 	/* Enable RS485 mode: */
 	rs485conf.flags |= SER_RS485_ENABLED;
-- 
2.14.2

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

* Re: [PATCH] Documentation/rs485: Fix missing zero init on sample code
  2017-11-06 10:51 [PATCH] Documentation/rs485: Fix missing zero init on sample code Ricardo Ribalda Delgado
@ 2017-11-07 13:28 ` Jiri Slaby
  2017-11-07 16:09   ` Ricardo Ribalda Delgado
  0 siblings, 1 reply; 3+ messages in thread
From: Jiri Slaby @ 2017-11-07 13:28 UTC (permalink / raw)
  To: Ricardo Ribalda Delgado, Greg Kroah-Hartman, Jonathan Corbet,
	linux-doc, linux-kernel, claudio

On 11/06/2017, 11:51 AM, Ricardo Ribalda Delgado wrote:
> The sample code does not initialize to zero a local variable and then it
> uses the uninitialized code.
> 
> Fix in case someone copy/paste the sample code.
> 
> Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
> ---
>  Documentation/serial/serial-rs485.txt | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/Documentation/serial/serial-rs485.txt b/Documentation/serial/serial-rs485.txt
> index 389fcd4759e9..2bbae93bf279 100644
> --- a/Documentation/serial/serial-rs485.txt
> +++ b/Documentation/serial/serial-rs485.txt
> @@ -54,7 +54,7 @@
>  		/* Error handling. See errno. */
>  	}
>  
> -	struct serial_rs485 rs485conf;
> +	struct serial_rs485 rs485conf = {};

I think that TIOCGRS485 is missing here instead. Ccing the author of the
text.

Does it break classifying potatoes :)?

>  	/* Enable RS485 mode: */
>  	rs485conf.flags |= SER_RS485_ENABLED;
> 

thanks,
-- 
js
suse labs

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

* Re: [PATCH] Documentation/rs485: Fix missing zero init on sample code
  2017-11-07 13:28 ` Jiri Slaby
@ 2017-11-07 16:09   ` Ricardo Ribalda Delgado
  0 siblings, 0 replies; 3+ messages in thread
From: Ricardo Ribalda Delgado @ 2017-11-07 16:09 UTC (permalink / raw)
  To: Jiri Slaby; +Cc: Greg Kroah-Hartman, Jonathan Corbet, linux-doc, LKML, claudio

Hi Jiri

On Tue, Nov 7, 2017 at 2:28 PM, Jiri Slaby <jslaby@suse.cz> wrote:
> On 11/06/2017, 11:51 AM, Ricardo Ribalda Delgado wrote:
>> The sample code does not initialize to zero a local variable and then it
>> uses the uninitialized code.
>>
>> Fix in case someone copy/paste the sample code.
>>
>> Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
>> ---
>>  Documentation/serial/serial-rs485.txt | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/Documentation/serial/serial-rs485.txt b/Documentation/serial/serial-rs485.txt
>> index 389fcd4759e9..2bbae93bf279 100644
>> --- a/Documentation/serial/serial-rs485.txt
>> +++ b/Documentation/serial/serial-rs485.txt
>> @@ -54,7 +54,7 @@
>>               /* Error handling. See errno. */
>>       }
>>
>> -     struct serial_rs485 rs485conf;
>> +     struct serial_rs485 rs485conf = {};
>
> I think that TIOCGRS485 is missing here instead. Ccing the author of the
> text.
>
That will also do.



> Does it break classifying potatoes :)?

The potato machine has to speak to other industrial machines :).

Hey!: I am running of potatoes!, Need another truck.

>
>>       /* Enable RS485 mode: */
>>       rs485conf.flags |= SER_RS485_ENABLED;
>>
>
> thanks,
> --
> js
> suse labs



-- 
Ricardo Ribalda

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

end of thread, other threads:[~2017-11-07 16:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-06 10:51 [PATCH] Documentation/rs485: Fix missing zero init on sample code Ricardo Ribalda Delgado
2017-11-07 13:28 ` Jiri Slaby
2017-11-07 16:09   ` Ricardo Ribalda Delgado

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.