All of lore.kernel.org
 help / color / mirror / Atom feed
From: Oliver Hartkopp <socketcan@hartkopp.net>
To: yegorslists@googlemail.com, linux-can@vger.kernel.org
Cc: mkl@pengutronix.de
Subject: Re: [PATCH] slcanpty: declare command buffer static
Date: Mon, 13 Jan 2014 18:56:28 +0100	[thread overview]
Message-ID: <52D428CC.3000904@hartkopp.net> (raw)
In-Reply-To: <1389619756-28940-1-git-send-email-yegorslists@googlemail.com>



On 13.01.2014 14:29, yegorslists@googlemail.com wrote:
> From: Yegor Yefremov <yegorslists@googlemail.com>
> 
> ASCII command buffer char buf[200] must be declared as static,
> because it holds incomplete commands between pty2can() calls.
> Without static it is not guaranteed, that buf retains the same
> data between calls.
> 
> Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>

Acked-by: Oliver Hartkopp <socketcan@hartkopp.net>

Hi Yegor,

indeed the rxoffset is a static variable to handle incomplete ASCII commands
(in buf[]) and therefore it makes no sense when the referenced buffer would
not be static then ...

Thanks for catching this.

Best regards,
Oliver

> ---
>  slcanpty.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/slcanpty.c b/slcanpty.c
> index 2c1cabe..c062a02 100644
> --- a/slcanpty.c
> +++ b/slcanpty.c
> @@ -68,7 +68,7 @@ int pty2can(int pty, int socket, struct can_filter *fi,
>  {
>  	int nbytes;
>  	char cmd;
> -	char buf[200];
> +	static char buf[200];
>  	char replybuf[10]; /* for answers to received commands */
>  	int ptr;
>  	struct can_frame frame;
> 

  reply	other threads:[~2014-01-13 17:56 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-13 13:29 [PATCH] slcanpty: declare command buffer static yegorslists
2014-01-13 17:56 ` Oliver Hartkopp [this message]
2014-01-16 16:18 ` Marc Kleine-Budde

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=52D428CC.3000904@hartkopp.net \
    --to=socketcan@hartkopp.net \
    --cc=linux-can@vger.kernel.org \
    --cc=mkl@pengutronix.de \
    --cc=yegorslists@googlemail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.