Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2524938imu; Sun, 23 Dec 2018 01:35:54 -0800 (PST) X-Google-Smtp-Source: AFSGD/UByOlhvFFsxaZ1Wy4N8a8r75w/gAxX7N7yoQh8u+FMGDb46+E2hN2pDjQocH6F2EuY64pe X-Received: by 2002:a62:13c3:: with SMTP id 64mr9137459pft.93.1545557754457; Sun, 23 Dec 2018 01:35:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545557754; cv=none; d=google.com; s=arc-20160816; b=WNaYrL/YmesC720V/7W4cG7uTs8VKLPU41JhCWGNZZKW/VdRi2FUfhsfWsPcI40k2E 39r//q+tsV3zTOszXwk5IsIMY3E2ddb8YwDDgHzcoa3gi8QRaS6B9QxPE4otYTnI5PBW gMnuMtJJ2m8bsJjXH5tk2F/hmXQ+6sCw89ol82gQ858iaTK5l+ITS6Xile/F62g5d+DX 0PrB5MCbMblRFTIEkwIklNDsi+A+luKeBH3oIP2KEDc0UHDbHky2aFsrUQZkitfqSaKS ZhQHEwckmW7Jz/f6Al21c5X+pmjAenIkC6MRto5TAgQFazxd1brUZoCdMjTwCDJr/lSX HpIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=umSUn5Ci9dA3t2XruE1eAp2L46+qSHbncfbdX3L7+rI=; b=1D0w1VJEDVwpPJlhuLRjQiCohn8xYTNaPb55VdSvdYSoKJP4ynx7xqNvlMmNHsl9DX GoXqV8PVoxTy92HTdLnXcajuVMRUCIOshvXuhK4QlJ6Vn7JviM/ASj1q+OSAMv8ueXzH 0xp7cMwuHgHf0Eu/aWDuRXBxDxag56Lp22cmsGrxQD7v8+XTiBmjsqmZ9Td2sJx6eSE8 rWUXuLaXCgn8AWjATUKubbc/i/MCxyREoGxp4LHlhvhHPdZBNWLLHiq2RVgSRJR7SwPr c9acC3aFtAzZWEJvnNBhMUzdt6FPe3b1BIMwVnvg91zBG8Ti6e25vCf62rUAuyFBrMup GyAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=NVAFjWfA; 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 t75si26048461pfa.170.2018.12.23.01.35.38; Sun, 23 Dec 2018 01:35:54 -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; dkim=pass header.i=@linux-foundation.org header.s=google header.b=NVAFjWfA; 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 S2392118AbeLUWIc (ORCPT + 99 others); Fri, 21 Dec 2018 17:08:32 -0500 Received: from mail-lj1-f194.google.com ([209.85.208.194]:33063 "EHLO mail-lj1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732390AbeLUWIc (ORCPT ); Fri, 21 Dec 2018 17:08:32 -0500 Received: by mail-lj1-f194.google.com with SMTP id v1-v6so6031205ljd.0 for ; Fri, 21 Dec 2018 14:08:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=umSUn5Ci9dA3t2XruE1eAp2L46+qSHbncfbdX3L7+rI=; b=NVAFjWfAqGqJLkCbCLkU6eZzsVvyLLlrwBhT6kUhFW2MOQ+OaiWc6WatxrkUdGlm3Q /6dn6UruSIADY+CkTUS2vI/uFvJtot8NCO1mGdZOm776aUN9jF0Qi9QxYtc9bM5iYQEK O9O7X6KmbnB1VjNFNS1fPfVvi9Ghozu2rPdXw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=umSUn5Ci9dA3t2XruE1eAp2L46+qSHbncfbdX3L7+rI=; b=ALfrGIStZWKOh9k0VzLoV2zeaA+5QT524UuddMZkvJkI0sn/de+fx8pxCdjwNIq75w wXlqUdgx4Z4Yw82/5ZWb2WSM5X2nydsZEFolCsVdzHCgDRktNWzRZxMsXe8pV/XcyJFf 2E92Ej9bFdXQ6JJQSBeXEo+m75YCyXO6CsIT7CHzIGgwtrLy/yRnEtTJFosQMfsD/2Fp 8oxcUwA1Mzfb08kPrbe71ByZyukk/ytyIKQVSk8e5qKA/EpbX5OElXqCtlbNMCuMRaOd 9gsG6nenuQu4Ev/TpsGPd7C5ydKWNZkDNeYnNckHVp3q8hMorvCc37XGFEz60r9owaIY /mFQ== X-Gm-Message-State: AJcUukcy3TyqLcAyqmXpkjGaDuMet94no2gMZK2qSnUMGPMZlghI+JMg QPdrPLaMeJCwr3H6cB+JJMfNb1BkPMo= X-Received: by 2002:a2e:2c02:: with SMTP id s2-v6mr2708191ljs.118.1545430109749; Fri, 21 Dec 2018 14:08:29 -0800 (PST) Received: from mail-lj1-f178.google.com (mail-lj1-f178.google.com. [209.85.208.178]) by smtp.gmail.com with ESMTPSA id k11-v6sm4968221ljk.40.2018.12.21.14.08.28 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 21 Dec 2018 14:08:28 -0800 (PST) Received: by mail-lj1-f178.google.com with SMTP id v15-v6so5995389ljh.13 for ; Fri, 21 Dec 2018 14:08:28 -0800 (PST) X-Received: by 2002:a2e:95c6:: with SMTP id y6-v6mr2571097ljh.59.1545430108025; Fri, 21 Dec 2018 14:08:28 -0800 (PST) MIME-Version: 1.0 References: <20181221175618.968519903@goodmis.org> <20181221175659.208858193@goodmis.org> <20181221144054.20bdeb33@gandalf.local.home> <20181221153526.5e6055ca@gandalf.local.home> <20181221155513.11450ca6@gandalf.local.home> In-Reply-To: <20181221155513.11450ca6@gandalf.local.home> From: Linus Torvalds Date: Fri, 21 Dec 2018 14:08:11 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [for-next][PATCH 23/24] string.h: Add strncmp_prefix() helper macro To: Steven Rostedt Cc: Linux List Kernel Mailing , Ingo Molnar , Andrew Morton , Namhyung Kim , Masami Hiramatsu , Joe Perches , Tom Zanussi , Greg Kroah-Hartman Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Dec 21, 2018 at 12:55 PM Steven Rostedt wrote: > > On Fri, 21 Dec 2018 12:41:17 -0800 > Linus Torvalds wrote: > > > Parentheses.... > > ? Your patch actually had them, but in the body of your email you did > #define have_prefix(str, prefix) ({ \ > const char *__pfx = (const char *)prefix; \ which is just completely wrong. Considering your _old_ patch had the exact same bug, I really think you need to start internalizing the whole "macro arguments *have* to be properly protected" thing. And I agree with Joe that using a million underscores just makes code less legible. Two underscores at the beginning is the standard namespace protection. Underscores at the end do nothing. And using *more* than two is just crazy. Finally, I think the cast is actually bogus and wrong. Why would the prefix ever be anything but "const char *"? Adding the cast only makes it more possible that somebody uses a truly wrong type ("unsigned long *" ?), and then the cast just silently hides it. If somebody uses "unsigned char *" for this, they'd get the exact same warning if they were using strncmp and do this by hand. So why would that helper function act any differently? Particularly when it then has the huge downside that it will also accept absolute garbage? Anyway, that was a long and winding NAK for your patch. Linus