All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] kgdboc: Fix restrict error
@ 2018-09-10 23:20 Laura Abbott
  2018-09-11 12:49 ` Daniel Thompson
  0 siblings, 1 reply; 2+ messages in thread
From: Laura Abbott @ 2018-09-10 23:20 UTC (permalink / raw)
  To: Jason Wessel, Daniel Thompson
  Cc: Laura Abbott, Greg Kroah-Hartman, Jiri Slaby, kgdb-bugreport,
	linux-serial, linux-kernel

There's an error when compiled with restrict:

drivers/tty/serial/kgdboc.c: In function ‘configure_kgdboc’:
drivers/tty/serial/kgdboc.c:137:2: error: ‘strcpy’ source argument is the same
as destination [-Werror=restrict]
  strcpy(config, opt);
  ^~~~~~~~~~~~~~~~~~~

As the error implies, this is from trying to use config as both source and
destination. Drop the call to the function where config is the argument
since nothing else happens in the function.

Signed-off-by: Laura Abbott <labbott@redhat.com>
---
 drivers/tty/serial/kgdboc.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/tty/serial/kgdboc.c b/drivers/tty/serial/kgdboc.c
index b4ba2b1dab76..dd503743bbff 100644
--- a/drivers/tty/serial/kgdboc.c
+++ b/drivers/tty/serial/kgdboc.c
@@ -154,15 +154,13 @@ static int configure_kgdboc(void)
 {
 	struct tty_driver *p;
 	int tty_line = 0;
-	int err;
+	int err = -ENODEV;
 	char *cptr = config;
 	struct console *cons;
 
-	err = kgdboc_option_setup(config);
-	if (err || !strlen(config) || isspace(config[0]))
+	if (!strlen(config) || isspace(config[0]))
 		goto noconfig;
 
-	err = -ENODEV;
 	kgdboc_io_ops.is_console = 0;
 	kgdb_tty_driver = NULL;
 
-- 
2.17.1


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

* Re: [PATCH] kgdboc: Fix restrict error
  2018-09-10 23:20 [PATCH] kgdboc: Fix restrict error Laura Abbott
@ 2018-09-11 12:49 ` Daniel Thompson
  0 siblings, 0 replies; 2+ messages in thread
From: Daniel Thompson @ 2018-09-11 12:49 UTC (permalink / raw)
  To: Laura Abbott
  Cc: Jason Wessel, Greg Kroah-Hartman, Jiri Slaby, kgdb-bugreport,
	linux-serial, linux-kernel

On Mon, Sep 10, 2018 at 04:20:14PM -0700, Laura Abbott wrote:
> There's an error when compiled with restrict:
> 
> drivers/tty/serial/kgdboc.c: In function ‘configure_kgdboc’:
> drivers/tty/serial/kgdboc.c:137:2: error: ‘strcpy’ source argument is the same
> as destination [-Werror=restrict]
>   strcpy(config, opt);
>   ^~~~~~~~~~~~~~~~~~~
> 
> As the error implies, this is from trying to use config as both source and
> destination. Drop the call to the function where config is the argument
> since nothing else happens in the function.
> 
> Signed-off-by: Laura Abbott <labbott@redhat.com>

Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org>

> ---
>  drivers/tty/serial/kgdboc.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/tty/serial/kgdboc.c b/drivers/tty/serial/kgdboc.c
> index b4ba2b1dab76..dd503743bbff 100644
> --- a/drivers/tty/serial/kgdboc.c
> +++ b/drivers/tty/serial/kgdboc.c
> @@ -154,15 +154,13 @@ static int configure_kgdboc(void)
>  {
>  	struct tty_driver *p;
>  	int tty_line = 0;
> -	int err;
> +	int err = -ENODEV;
>  	char *cptr = config;
>  	struct console *cons;
>  
> -	err = kgdboc_option_setup(config);
> -	if (err || !strlen(config) || isspace(config[0]))
> +	if (!strlen(config) || isspace(config[0]))
>  		goto noconfig;
>  
> -	err = -ENODEV;
>  	kgdboc_io_ops.is_console = 0;
>  	kgdb_tty_driver = NULL;
>  
> -- 
> 2.17.1
> 

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

end of thread, other threads:[~2018-09-11 12:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-10 23:20 [PATCH] kgdboc: Fix restrict error Laura Abbott
2018-09-11 12:49 ` Daniel Thompson

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.