Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2525659imu; Sun, 23 Dec 2018 01:37:01 -0800 (PST) X-Google-Smtp-Source: ALg8bN7TGjrpUEBYU9lNsesw2d6NmGrAaPs2llVM3gPVmtl8qiJ095iSfUraI6N0Rfi8XPd5IoVw X-Received: by 2002:a17:902:d83:: with SMTP id 3mr8944597plv.43.1545557821778; Sun, 23 Dec 2018 01:37:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545557821; cv=none; d=google.com; s=arc-20160816; b=Z7NIoHGSe3X+CpDDngv2yXRgQetz6WfACpee52/MrdDktdr1SgEeHM/OP6bHn1V9wm OorWvjiEodmgpzcB2y02eqaLSziJS3gchRT6581cohB/Pjz4awGyM5iz8aqHyhUuSHr6 dqUp+cxOUsfOUKZXgx2AUmYe9E0J5wNh7zFPzHMt9CSVyuS+XYZgIKUAm+dk6qg0Xpmg 5LXMOspdqMlRPh3MSvCAGcOj3olVX9j7hGvNCm8dRteEr0ILtk/u82IztZBuPn9DS9l2 Hp9EYChf67p6gOdLxWhFAzR0Yaa+/O9KacONFC3CQIWjSVXrguwl/DBqT1HzobYpjMwG 4hhw== 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=AYnSPgQrUKFm8qMBlc9X79d5wgZQUGMC7qSuUVJiHB0=; b=D9jiJJUY9QodXdNOUUXxogGHY02eD2Z7swQCLbEn3uPubg7CfFuywnU1scxi7v0uoG 4Sm6ET0fEAKFULLLdDeBi6qfq5Zt9L8E70/0nZGVMM7yMuY8xU9LGQLrSLdu49MuTVDP mQinqoleoHSgQ79GnYekq+0laSbm8lsNovx/mjphVQIf/PiOW6u7tNv6rMgLUsBbeetO bedplmfGP25HbbxtUTsYuJIG2M6siEauUexNFjyVGwJ8l96wVOfPAs+85D+6i4C5ZUjp ztInWyEbU41vo9oSPJc22MZxGv1dO7tqGvGqe+x+8NmFwLQ9RVnVWlyevJNAePRIOoT7 /tdA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=GZ1ouaNZ; 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 g187si25381914pfc.43.2018.12.23.01.36.46; Sun, 23 Dec 2018 01:37:01 -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=GZ1ouaNZ; 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 S2403808AbeLUW5d (ORCPT + 99 others); Fri, 21 Dec 2018 17:57:33 -0500 Received: from mail-lj1-f194.google.com ([209.85.208.194]:43190 "EHLO mail-lj1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2392193AbeLUW5d (ORCPT ); Fri, 21 Dec 2018 17:57:33 -0500 Received: by mail-lj1-f194.google.com with SMTP id q2-v6so6080664lji.10 for ; Fri, 21 Dec 2018 14:57:32 -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=AYnSPgQrUKFm8qMBlc9X79d5wgZQUGMC7qSuUVJiHB0=; b=GZ1ouaNZpu9t9mAsgS9RJnHiRZDmTbu88zrN6Cz/D3cpis1HvdbZyJUZHgeKoc78CG xXSx0E0OcA/kpaD0U7zaLEx/si9LdLx3O70aYfvFgtcIp7aTpj02N9nbfCQrovAq4Npd yYzu6SdK4tzMZJrG4MmymBSnqLPDYOibrb6yQ= 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=AYnSPgQrUKFm8qMBlc9X79d5wgZQUGMC7qSuUVJiHB0=; b=gNyPHQQ2U3Xgt0k2rLPIvRZ6RoE8kb4Mqp7WaSubB+BOyqf32vFOCv2M8wNIyiPwsD 0W2W2YFP4PQOANvI5to7f/w10KN8acDz0deVj6VzAIICotIwdi2WUvDM/UKeXY5cn0gb LBoWGvRLwVbdugl6bk1W193NEldFKfQbrzzR3p5GIoz9DfyABr0+xqPtVyEwTkuWccxQ B+nKvPgf8uZUo47f5v/LpOCiXoc4RQADOsGeLpJu9X3nxh0zVIuV34BbuhiGZvGeEgCv UcndEy6GOyI4BP5SrqOS6gQ9KUNqQfWG8cimoteJgsZwmHr5yoBjGTxercM+qbv23RVT yhcg== X-Gm-Message-State: AA+aEWYNPdT8eKHrDigvZi1q41X5twe6llO9BukJyk0Tib2eDuKVA0xB poxc4MCKcQ6jNXc9mQgmtX8aMfdh4TA= X-Received: by 2002:a2e:974a:: with SMTP id f10-v6mr3051252ljj.61.1545433050964; Fri, 21 Dec 2018 14:57:30 -0800 (PST) Received: from mail-lj1-f177.google.com (mail-lj1-f177.google.com. [209.85.208.177]) by smtp.gmail.com with ESMTPSA id c203sm5074780lfe.95.2018.12.21.14.57.29 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 21 Dec 2018 14:57:29 -0800 (PST) Received: by mail-lj1-f177.google.com with SMTP id t18-v6so6084665ljd.4 for ; Fri, 21 Dec 2018 14:57:29 -0800 (PST) X-Received: by 2002:a2e:9983:: with SMTP id w3-v6mr2914084lji.133.1545433049165; Fri, 21 Dec 2018 14:57:29 -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> <20181221174816.0ed7af47@gandalf.local.home> In-Reply-To: <20181221174816.0ed7af47@gandalf.local.home> From: Linus Torvalds Date: Fri, 21 Dec 2018 14:57:13 -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 2:48 PM Steven Rostedt wrote: > > > 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. > > Well, there's less with assignments that can go wrong than with other > code. That is, there's little that can happen with "int x = arg;" where > arg is the macro paramater to cause something really nasty. What's wrong, Steven? The assignment is entirely irrelevant. The problem is the cast. A type cast has a very high priority, and so if you do (const char *)prefix it breaks completely if you might have something like"a+6" as the argument. Think about what if "a" is of type "unsigned long", for example? Linus