Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp3624752ybz; Mon, 27 Apr 2020 20:01:51 -0700 (PDT) X-Google-Smtp-Source: APiQypLPnBFNWpeftg4LZVZOkon8WtXbiyTWsidhAY4bSda7AyXnuvG6VqWUCbwznZ3Fah8SfIZP X-Received: by 2002:a17:906:4ecb:: with SMTP id i11mr21780393ejv.79.1588042911221; Mon, 27 Apr 2020 20:01:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588042911; cv=none; d=google.com; s=arc-20160816; b=iDN7zbyIpCzM46bqGLuUyGU5/dMCip5k2BqcRyOl1uyMxRNrAs6f37HLltBQTx7gh8 QRcyj1o/JNxvXcX8pplHCNPIQkIevsUc3ZmwUnRX0cA3K6GQrmnMu4UL9U4Zz2MylQ8m ofni1DGh+T33Uj1o8cd7UZFpyFBSk35FuR7285nU8a9802+GgJGsRJUGRtfwDoEEmnZM 89KpqI4cwFyddd3vv6nsybGOmwIchAPgtR9H8b0wubUYlQgGezEiIRT0Urr9YMrxNuWD 7zXKCFOuHck64krI/WuTbm73pp2mTNte17UYWiLPjKhoyeXuTbt72nv/B9ws7U8SI241 p1Qg== 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:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=95kiZc3zWrwbqDPjAcyjvs+//e1XAUjcwT964zXqr0M=; b=bgSKpeF6LNyReSfRCv3zzPTLUtYHzXOVJ6Bfc8kQ2wjysXPaKnRjUinNYVby5qIz6c Hvj1RIMt1a6rmAY0DdZFg1fYnCrUFyV4vMtn4WJvFfdOCiPF6/cx0VzpJK/r9M2MUwni WktW3FuSwKlkQNdx7O5w43WGhh8K2jBVnp2Um//fXS4E7YMF/B27s9b5GOL7BNtr0BQr 2ZPOKcgut2eYHsrN19K9ingbwSq5E483CHj/s8gezDumDRylyMi9FAMs4TdDYC7abfF/ uuGCbU2d3nmkAEjfbmJyhJe3NKnYkkGZE7air5ZJPd1b2ugiPq82bCmA4G4uec8RqR7V ZSGw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e23si862819edq.517.2020.04.27.20.01.28; Mon, 27 Apr 2020 20:01:51 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726440AbgD1C7s (ORCPT + 99 others); Mon, 27 Apr 2020 22:59:48 -0400 Received: from mail.kernel.org ([198.145.29.99]:57196 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726418AbgD1C7r (ORCPT ); Mon, 27 Apr 2020 22:59:47 -0400 Received: from gandalf.local.home (cpe-66-24-58-225.stny.res.rr.com [66.24.58.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 3FE0E206B8; Tue, 28 Apr 2020 02:59:46 +0000 (UTC) Date: Mon, 27 Apr 2020 22:59:44 -0400 From: Steven Rostedt To: Gavin Shan Cc: Mark Rutland , catalin.marinas@arm.com, linux-kernel@vger.kernel.org, shan.gavin@gmail.com, will@kernel.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH] arm64/mm: Reject invalid NUMA option Message-ID: <20200427225944.185d4431@gandalf.local.home> In-Reply-To: <20200427225406.7cacc796@gandalf.local.home> References: <20200424045314.16017-1-gshan@redhat.com> <20200424101132.GC1167@C02TD0UTHF1T.local> <20200427225406.7cacc796@gandalf.local.home> X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 27 Apr 2020 22:54:06 -0400 Steven Rostedt wrote: > On Tue, 28 Apr 2020 10:59:14 +1000 > Gavin Shan wrote: > > > Hi Mark, > > > > On 4/24/20 8:11 PM, Mark Rutland wrote: > > > [Adding Steve, who added str_has_prefix()] > > > > > > On Fri, Apr 24, 2020 at 02:53:14PM +1000, Gavin Shan wrote: > > >> The NUMA option is parsed by str_has_prefix() and the invalid option > > >> like "numa=o" can be regarded as "numa=off" wrongly. > > > > > > Are you certain that can pass? If that can happen, str_has_prefix() is > > > misnamed and does not seem to do what its kerneldoc says it does, as > > > "off" is not a prefix of "o". > > > > > > > Yes, It's possible. str_has_prefix() depends on strncmp(). In this particular > > case, it's equal to the snippet of code as below: strncmp() returns zero. > > str_has_prefix() returns 3. > > Wait! strncmp("o", "off", 3) returns zero? > > That to me looks like a bug! > > This means str_has_prefix() is broken in other areas as well. > > > > > > int strncmp(const char *cs, const char *ct, size_t count) > > { > > unsigned char c1, c2; > > > > while (count) { > > c1 = *cs++; > > c2 = *ct++; > > if (c1 != c2) > > return c1 < c2 ? -1 : 1; > > if (!c1) /* break after first character is compared */ > > Crap! That is totally wrong! Looking at this again, it's not wrong. But how did we get here if c2 isn't zero as well? -- Steve