Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp2058931pxu; Tue, 24 Nov 2020 16:09:21 -0800 (PST) X-Google-Smtp-Source: ABdhPJzVadp+9AebQ69vvPoIPL+tbWXs7e6mzfDCGijKXHfbrpEde2aqJWoq1PVozLfbnOGM8Nyo X-Received: by 2002:a17:906:3102:: with SMTP id 2mr882789ejx.135.1606262961481; Tue, 24 Nov 2020 16:09:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606262961; cv=none; d=google.com; s=arc-20160816; b=ypSb9mI8g63WzE+O0Dvzj0JY8BOnsMUMT4R6PFNZOuB9gvE6mfgaUUlwQv3CAq2qLq 1TMzwGPKjrtXMqTsUVTRAFtKKqWQIJaIu7NpwsvxJhur7TuIvQ1lZgTdIsHVFJ2PSFkx HTpABIFBc3UzyrW6ezYH5GSQiueSpGpZofnkDnBcW9OtBnJt4fmz9yUwjnVt2PNnYIIE /rtrjPCazD5C+FiqhevilPe+DKpAIrDVEuacyf+wtTDsY6jqF/54k/wJ+4muGV2sqR1y M7APbiR/0MHJgyQj8lSqDlE1SqWd2JWauLaIEJ+GpU31AyhYl5MVyxPvqTbW8xuJLqZN pUuA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=nS9jd/mrs9MANJ2dhJ0iSNpa7XNy6i71AQudliWRJZs=; b=AJYiGD0A9sLMMLY8bWDO2Ybu/3UbuCkkwEKIuobCAi1IvvFaJhSsNl8IkRVlhs63i7 YGZevkydXkr3HU4LUZwf8kP4Uwb6smeWDywmtvb8UXUSJp7PGksj/ttXEhspe0AnFinq KX4ZeXXEv7TxabK6Te0o74ssDS8OqG6fBjfVrAjEyyHgrZTaDqbFdZN7Ci4ejUVKDQ1V /KxHr8ShLdTXborXaIGMrTUN8IEPfURfE7/7qxMZ50WkMcZ/kLuMO/i5AP4ikYmYV+hU xkBwo/gszWJnTzwh76hJCrSUsCQKfMQAi7oCCbi/p9rq/MTdlww3tnjRdazMZOuZYsWc OvTQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=LExSxRx8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id sb4si265149ejb.750.2020.11.24.16.08.58; Tue, 24 Nov 2020 16:09:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=LExSxRx8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726715AbgKXX7M (ORCPT + 99 others); Tue, 24 Nov 2020 18:59:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47002 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725868AbgKXX7L (ORCPT ); Tue, 24 Nov 2020 18:59:11 -0500 Received: from mail-pl1-x631.google.com (mail-pl1-x631.google.com [IPv6:2607:f8b0:4864:20::631]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9991FC0613D6; Tue, 24 Nov 2020 15:59:11 -0800 (PST) Received: by mail-pl1-x631.google.com with SMTP id 18so146594pli.13; Tue, 24 Nov 2020 15:59:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=nS9jd/mrs9MANJ2dhJ0iSNpa7XNy6i71AQudliWRJZs=; b=LExSxRx8TVfjgyGXal3rtgrWM44StwuPTNQiCVcmURvHxBm40B70wdMMcbm37X5pPt 43OCNOmxjMPIk8lGxrw8rbt+sdCjGkoRbOxnwuWdgs0ER64dijCQDUGS9E0EONM2eQQg hF1Iz/5IvfG2nqzBb89iGfwtjLT2MS2ije71MC/FM8voq4swAhbg53RsUPH/eE0GYCQ0 nxpFK8o/Ab6+zTeByqjMNQDtZ1yeI8OAnECWgvoUxdD0bqZlF4jLVpFw6LDSqabd6bL6 y5HlYHSiipkdBycN0IErhjb98BQPVIrWMBjAIYXMNaFR4nZLkl4q9w+tHRbp465DXikt 1XlQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=nS9jd/mrs9MANJ2dhJ0iSNpa7XNy6i71AQudliWRJZs=; b=ccprlBdBpUvR89ya7f34E9Hd6DjyQC9jMbI0lylb/PdulEUUO+EP9jiw6SuSYcZrXi q0Z/zrM5SsmV6Qh4bBsUmj8JbDV8bpgtFIwC+UCodh4aqw2atdLzjWEqhEy5klLL4HI0 LEBkvJrtAydQUjiPTfRiBfZd84QtxL2+jKOt3cQ/PgHWu1Anl9K0J1IAt9sOOsSXogYx yflPPmzvKilBQqYiy4cKPxgDoinnBQURRgTDRm8+6rPHenAkDUq+9tbDLkwThLLDuvr8 9lB6O/y0O/UnfYryNlhUAcNNZYpJeAu+Pqpr32sLYL52a5smvFDoPa7hbwR0ojE3GdCT ZnoA== X-Gm-Message-State: AOAM531yJczw/W/AiroJTUuwmynQ9c8Yfgmx1mgM5vXjVCejXO//N2UU lMyPInU+uH2SxYmyBCSjLTdCZc6o4CQ= X-Received: by 2002:a17:902:9a84:b029:d9:d5ad:a669 with SMTP id w4-20020a1709029a84b02900d9d5ada669mr783347plp.53.1606262351169; Tue, 24 Nov 2020 15:59:11 -0800 (PST) Received: from hoboy.vegasvil.org (c-73-241-114-122.hsd1.ca.comcast.net. [73.241.114.122]) by smtp.gmail.com with ESMTPSA id f18sm136532pfa.167.2020.11.24.15.59.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Nov 2020 15:59:10 -0800 (PST) Date: Tue, 24 Nov 2020 15:59:08 -0800 From: Richard Cochran To: min.li.xe@renesas.com Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 net] ptp: clockmatrix: bug fix for idtcm_strverscmp Message-ID: <20201124235908.GA28743@hoboy.vegasvil.org> References: <1606233686-22785-1-git-send-email-min.li.xe@renesas.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1606233686-22785-1-git-send-email-min.li.xe@renesas.com> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Nov 24, 2020 at 11:01:26AM -0500, min.li.xe@renesas.com wrote: > From: Min Li > > Feed kstrtou8 with NULL terminated string. > > Changes since v1: > -Use sscanf to get rid of adhoc string parse. This is much nicer. Small issue remains... > + u8 ver1[3], ver2[3]; > + int i; > + > + if (sscanf(version1, "%hhu.%hhu.%hhu", > + &ver1[0], &ver1[1], &ver1[2]) < 0) > + return -1; The sscanf function returns the number of scanned items, and so you should check that it returns 3 (three). > + if (sscanf(version2, "%hhu.%hhu.%hhu", > + &ver2[0], &ver2[1], &ver2[2]) < 0) > + return -1; Same here. Thanks, Richard