Received: by 10.223.185.116 with SMTP id b49csp4272225wrg; Mon, 26 Feb 2018 14:30:45 -0800 (PST) X-Google-Smtp-Source: AG47ELsAKDj3dPko5aGwPFvakKiUydEnfHi/Vk8qPC+h5bFoFCBdK/d10aVfn980PxipqWyagMjU X-Received: by 2002:a17:902:20e5:: with SMTP id v34-v6mr7911542plg.66.1519684245659; Mon, 26 Feb 2018 14:30:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519684245; cv=none; d=google.com; s=arc-20160816; b=NAGFZwmbiwmEwoMNwd5uJmSgbBJZEsjtoqIvCJqb8n8WbBJu0/aW/cWdiljj/CtIhd rI7qITUIPFzDf1hnox31YZy5RZEzax9IKSf50sikXUnILUdLXM1xqtYfNfYkS4hU16H/ A0yaHbiLNXuQWmmS7ZZ7cL7dTCbcDAQP0LrWS8ChW2jtW1+vaOa+x/BE1orlNDvWh3Kr uVaa/nRvcUUH7dT8xEY6uw+DwX+bYxsEVX38w9NFWnfCM8Wek0zC8fd+UrOENhRqTNSh BH5Yqlje8vL6JHr3GjutBQJU3PfsNkPpcNafJYOuzU1OIQJxb68bO0uiWW0UReovoG+1 buVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=Nhq8/rh9LlQSsFxjwBazY00BfordJNNWJG7tGGLTVEo=; b=acsxDbygxtVsgmLzykkel2CrF/zIqjiAR6VrsH0tIYnSC8w9j9Qyiu3Sxbd2QCnU2z J4wTH+JBeztK7ecYANuepci3EQCjOIXweyri359Vyco51itH2b1EhH+ldgVNWGPckVAq dDnFCtC4OVRysVDj+BeumLauZdtYP7U+p035TxtEQCB394vwcdoKf51YSJgt0WuvpewS 0lqAX8YXAbTlZGgujA2zysc5B9gTUG1vXkq/Ykd5ukHE4nv1AN58lIVOPvULEq51HsAW 9Ke2KDLLGpzAMxXqxP6IVPQmvtjawMuI+9kuTmNUUuz7OksYfiiBq7FmVhF4fwWRv3Iq 96hA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w5si6026771pgv.514.2018.02.26.14.30.28; Mon, 26 Feb 2018 14:30:45 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751830AbeBZW3T (ORCPT + 99 others); Mon, 26 Feb 2018 17:29:19 -0500 Received: from mxf98a.netcup.net ([46.38.249.138]:41401 "EHLO mxf98a.netcup.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751569AbeBZW3S (ORCPT ); Mon, 26 Feb 2018 17:29:18 -0500 Received: from [192.168.178.21] (x4d071a18.dyn.telefonica.de [77.7.26.24]) by mxf98a.netcup.net (Postfix) with ESMTPSA id AE87E140805; Mon, 26 Feb 2018 23:29:16 +0100 (CET) Authentication-Results: mxf98a; spf=pass (sender IP is 77.7.26.24) smtp.mailfrom=rabel@robertabel.eu smtp.helo=[192.168.178.21] Received-SPF: pass (mxf98a: connection is authenticated) Subject: Re: [PATCH 3/4] auxdisplay: charlcd: fix x/y address commands To: Geert Uytterhoeven Cc: linux-kernel , Miguel Ojeda , Willy Tarreau , Andy Shevchenko References: <9ec3c54c-f8fe-22d7-783e-8cf9862405bb@robertabel.eu> <20180225235432.31209-1-rabel@robertabel.eu> <20180225235432.31209-2-rabel@robertabel.eu> <20180225235432.31209-3-rabel@robertabel.eu> <20180225235432.31209-4-rabel@robertabel.eu> From: Robert Abel Message-ID: <7fb01791-929a-540c-1ad7-395d38d2e419@robertabel.eu> Date: Mon, 26 Feb 2018 23:29:14 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: de-DE Content-Transfer-Encoding: 7bit X-PPP-Message-ID: <20180226222916.8286.4909@mxf98a.netcup.net> X-PPP-Vhost: robertabel.eu Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Geert, On 26 Feb 2018 09:46, Geert Uytterhoeven wrote: >> + >> + nxt_cmd = *esc++; >> + nxt_esc = esc; >> + >> + while ('\0' != *esc) { >> + >> + cmd = nxt_cmd; >> + esc = nxt_esc; >> + nxt_esc = strpbrk(esc, "xy;"); >> + if (NULL != nxt_esc) { >> + nxt_cmd = *nxt_esc; >> + /* terminate current sequence with NUL */ >> + *nxt_esc++ = '\0'; >> + } > > So if none of "x", "y", or ";" is found, nxt_cmd will still contain > the current command? > Shouldn't it be reset to '\0' or so? I originally had a comment there, but it then felt kinda silly. Since one of the conditions of the code is that a semicolon ';' is detected at the end of the stream, the situation you describe never occurs until the end of the command string. nxt_esc == NULL only when cmd == ';' and *esc == NULL. Since there is nothing to terminate and the code won't run again (due to while (*esc)), I didn't reset nxt_cmd. Other than that, I also don't know that there is a sensible reset value. Regards, Robert