From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 22EBCC433EF for ; Thu, 17 Mar 2022 11:46:48 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id ECD90837EF; Thu, 17 Mar 2022 12:46:45 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="UZqweosw"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 4F67783A29; Thu, 17 Mar 2022 12:46:44 +0100 (CET) Received: from mail-wm1-x32f.google.com (mail-wm1-x32f.google.com [IPv6:2a00:1450:4864:20::32f]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 355428340A for ; Thu, 17 Mar 2022 12:46:41 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=ptosi@google.com Received: by mail-wm1-x32f.google.com with SMTP id l1-20020a05600c4f0100b00389645443d2so3016775wmq.2 for ; Thu, 17 Mar 2022 04:46:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to; bh=beUdGJxz4YCw8KiP4EHpG7jhaR2jkhgTxBZyu6p0fQ8=; b=UZqweoswWokDk5KWRq8Lui5EjdDq+AuRh1t1Gu10b79FakB9yAm5XRA6SH9spI2FtR z6OLZrPd9Cv0I0o1wNHrjOOKq3PQJfQwVQwruMobveS1PD9NkDlrDzyh5yjzKmUT0nCm 3beLSG8SeMBkNNt8M72DHV+Q04T7N66cV9J+Dyiwnwgw0rv/JGXMPFDe0DiLLpaMDW7m zy5QHj/KZhUivBRxIRBeFq6Up0Nbdd3jcOKe5CRhKozYxjlVHRNixW4sLJGYg/hhcNA0 AUJYTpcH87sxdaIaicO69O35WUv4TUv7+iQq/DYlWcK1lm7Je+zUuxGOwW9gGjnc8psq /gTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=beUdGJxz4YCw8KiP4EHpG7jhaR2jkhgTxBZyu6p0fQ8=; b=eHc1hgy81VsJZJLVrf6/Ti/rcIbvcSLgF5/Z56QKtW2LWdyJC2ssD4K8alAURuPvNv /eba+SAxi3KViiOgMQV3M1iNk2CklANkrgV2CEoDAgMccMNypUlCmFpE8b8L/SMl8tPm 0+09CccjHHWw25/QXdu23uOnzLr8abChMXGzb+2btFO6V6KyswSnrwogJNFaQepKA+XV Cg5Uka1vI8QLXg2qIqAH9BaUu09HFF61INen4euHaGKN+AeqYRaR5xLrtBuKaof86FDW A/lJ/2HeB0pYq9HxZ//voWAWHFRzEqP7gFXr3/blsevuJIK2S/H329DNuXI4ZCL0cxRB dIxQ== X-Gm-Message-State: AOAM530idDIJOH9SOo0ZLb5jtkIVoarlML1BCsxY6SJI8V0Bn5wlWyc1 Xw4W/0FR016EHyGMCvTKuwyhmTzOlbL+GA== X-Google-Smtp-Source: ABdhPJxW9ePyFwSU29l8Gxxok7jaHr0Lbkw645AIXT9hjCWOBK6HitoKcRHedWbuT/IpBql4kFK0BQ== X-Received: by 2002:a1c:7c03:0:b0:38c:804d:d477 with SMTP id x3-20020a1c7c03000000b0038c804dd477mr1074445wmc.32.1647517600632; Thu, 17 Mar 2022 04:46:40 -0700 (PDT) Received: from google.com (203.75.199.104.bc.googleusercontent.com. [104.199.75.203]) by smtp.gmail.com with ESMTPSA id bg42-20020a05600c3caa00b00380deeaae72sm6081315wmb.1.2022.03.17.04.46.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Mar 2022 04:46:40 -0700 (PDT) Date: Thu, 17 Mar 2022 11:46:36 +0000 From: =?utf-8?Q?Pierre-Cl=C3=A9ment?= Tosi To: Simon Glass Cc: U-Boot Mailing List , Tom Rini Subject: Re: [PATCH 7/9] include: Upgrade Message-ID: <20220317114636.v2hmcmn564odjzjt@google.com> References: <20220316153948.197650-1-ptosi@google.com> <20220316153948.197650-7-ptosi@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.5 at phobos.denx.de X-Virus-Status: Clean On Wed, Mar 16, 2022 at 01:23:38PM -0600, Simon Glass wrote: > Hi, > > On Wed, 16 Mar 2022 at 09:41, Pierre-Clément Tosi wrote: > > > > Upgrade the header to version 5.16 of the kernel: > > > > commit df0cc57e057f18e44dac8e6c18aba47ab53202f9 > > > > Signed-off-by: Pierre-Clément Tosi > > Cc: Simon Glass > > Cc: Tom Rini > > --- > > include/linux/typecheck.h | 10 ++++++++++ > > 1 file changed, 10 insertions(+) > > Reviewed-by: Simon Glass > > But I don't understand how this works at all. Could you add a comment? This patch is a simple upgrade of the header. I needed it for another patch stack and, given how trivial and self-contained it is, I thought I would slip it into this one. If your "this" refers to the macro itself, an error should be generated by the compiler when dereferencing a non-pointer and it avoids introducing side effects through the use of __dummy but I'm not sure what the sizeof is there for; is it perhaps compliant for an implementation to keep generating code when encountering a dereferenced non-pointer (leading to a bogus result, from UB) so that sizeof forces it to depend on that expression being of a valid type? Or is it to do with catching variables of incomplete type e.g. arrays of unknown size? It was introduced by commit cb0f80039fb7 ("bitops: Add non-atomic bitops for pointers"), which doesn't provide much information either. > > > > > diff --git a/include/linux/typecheck.h b/include/linux/typecheck.h > > index eb5b74a575..46b15e2aae 100644 > > --- a/include/linux/typecheck.h > > +++ b/include/linux/typecheck.h > > @@ -1,3 +1,4 @@ > > +/* SPDX-License-Identifier: GPL-2.0 */ > > #ifndef TYPECHECK_H_INCLUDED > > #define TYPECHECK_H_INCLUDED > > > > @@ -21,4 +22,13 @@ > > (void)__tmp; \ > > }) > > > > +/* > > + * Check at compile time that something is a pointer type. > > + */ > > +#define typecheck_pointer(x) \ > > +({ typeof(x) __dummy; \ > > + (void)sizeof(*__dummy); \ > > + 1; \ > > +}) > > + > > #endif /* TYPECHECK_H_INCLUDED */ > > -- > > 2.35.1.723.g4982287a31-goog > > > > Regards, > Simon -- Pierre