Received: by 2002:a05:7412:3290:b0:fa:6e18:a558 with SMTP id ev16csp663185rdb; Fri, 26 Jan 2024 07:09:42 -0800 (PST) X-Google-Smtp-Source: AGHT+IEbepfaZSf5Ba76lD1/kNLbUnfoYLqglqPm2w5yCr/zvzWBZ1x07yzVl4fW+PrNKYWwT9mI X-Received: by 2002:a05:6a20:4c92:b0:199:359b:7e6d with SMTP id fq18-20020a056a204c9200b00199359b7e6dmr1476320pzb.108.1706281782009; Fri, 26 Jan 2024 07:09:42 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706281781; cv=pass; d=google.com; s=arc-20160816; b=XSuO4WHZmqVv9K3coBgB5WR0bwhTco029EBcDocouQzUrhUWhvvzuDDcRTTHyEGQ9h 5Z1h3boNVi/xxX0r+DtuEsuyc8hzeNINk9HVSpNLKmzz7HwV91GB9KCZAsK+eKU0lgI2 SGvh/5F2VBQU3diVNTGHXhulX+AzGErRDQPGaF0SpbpFOvO2VjQlcmnpMsWjTyigH4Rp MmN2Un5QaG2dtVlC4T2th6MUFz+ny1tYJt5m06eK8NsGKjqmV/hhA4BhjCgRIZw6qO5u feFqVRiBTOM2CFG6toGi8zw5EH3Z6Uy7MX6azC2jWqmkO7PtCc2KZ9MRmSxDPCjPBOCa bZlw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=onb58WbK7XX3zmn2vav9TfD/9KJKtooABn9lOzetSkA=; fh=5j3o3gRPXlaGk7hEQhcSZhqvv1K4HL1ubtD6i+K8Y3U=; b=FmBXJf7Qmc9wbve+CN0YJ02kGEuo+TYJBlvgzAPT4qaTmTOc4CQk6YQfCgBo2bvWPH CmjU7umdCwGm7lD00JqDenDf92ws4PAWQ22tjIY4GrRbN9PFD53m1KqdOgdS3Q487QSk dLkOlY0i91dqcJNOU7/iUv2GML7EliVs1zaXbWiSAUdoaOIFWUBhLhsTh5Cku1yZToU1 /KM7SCLopvYKMbchEbI77ueiUQxenSXthZX2hoVF8LmfLX+UMFKWHtA+xgFFn6OoZXF4 dNBDmMFbxpPOZz/aMQWncpXQGNJVWuYfq/1Y29r5p3QXFriNfj3VYLzIxTYqrY3WvwTa I4pw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="UJ/CrNAP"; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-40223-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-40223-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id s25-20020a635259000000b005d6787271aesi1244532pgl.237.2024.01.26.07.09.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Jan 2024 07:09:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-40223-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="UJ/CrNAP"; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-40223-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-40223-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 4B732B24E22 for ; Fri, 26 Jan 2024 14:46:29 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8C8301CA91; Fri, 26 Jan 2024 14:46:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="UJ/CrNAP" Received: from mail-oa1-f48.google.com (mail-oa1-f48.google.com [209.85.160.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6505B1C68F; Fri, 26 Jan 2024 14:46:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.48 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706280381; cv=none; b=TrRmmSAOD25mdlB4f2zrHMzXGAvMTMFiJVBY2gLmZaOTQypM7Sduwe6rjrGKVV3cs/1Kv4RtYkG/z/1cPePEX/BtITe2INOyOv1oz/gOppxfIU+W34YGX/esRmEIEuPWHQrhLBmbqj1uDDZ0QsLEX+9pqkA9dcFgmD8mlytlhRw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706280381; c=relaxed/simple; bh=oaR+Rs+o1ovCFQgcjvwFQtMJjDy9R3/Hi0ALcXjhD+E=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=MEWFIsJj6SxMWxZiGC5GXoZSMoy2+Y6lUwNS03d+9ycfpb9XyBjNnINzV7uPIAjOmw8lL3QvGrzL9ZKrCsMX87qLQTrg2xHSo/Io2A3opWHy4jTx86tgNRm3BbPxtF5WOz7w+7yYEvJLVmmbVWj3bBOUEAoQJ8IrUlcgqOCQyo4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=UJ/CrNAP; arc=none smtp.client-ip=209.85.160.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-oa1-f48.google.com with SMTP id 586e51a60fabf-20536d5c5c7so287339fac.2; Fri, 26 Jan 2024 06:46:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706280379; x=1706885179; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=onb58WbK7XX3zmn2vav9TfD/9KJKtooABn9lOzetSkA=; b=UJ/CrNAPySnj10klWyYzcD4jebFkC0SXyvvoQqfqc7Y9JcfgV/hJj+DJuUNBrxDwgO cViH1DO0/aKKfu7FfaXVsxGQiI2Rs+BkO7J8b5csrxo7twcI/wXp/QWd564H8nOMmL57 kF6zLtDhAX6qfdFe4tnLVZCnPXM8K8HhO8WOMy0lKyv9gzZkryU42u8IUdw7RKRznsyM n+rgV7usxs8yhSMY3RTaKir9zuBJCNr5/ieP1D7uXuWhw4dZ3KnUOKcQOP33pR8I0q3Q yFYhAYOpPBoeM1Xlfn5RXH9jz//G4wf9A1n5INLwFevg2785MwJ7P2Kmf4F9Fj/krTOG Kc8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706280379; x=1706885179; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=onb58WbK7XX3zmn2vav9TfD/9KJKtooABn9lOzetSkA=; b=VMRkwYhkgNZldtR6ouK7acknNSE5MKl34GxdtATyR4pqgNSIAr9GoWQDQzhUpzQ36g suT1BM9FhLZQqdPhNhb2xCoX8OquiYFcvet+gHxsq/2wmfJAdYR4jdobz9tkYrbaFaef utbufZ/a5fSugAqGXqwLs7FweURxD22+ziEZ4tx7RlSIdrnINp7Ii59/91ze/4Y1BQdP yBkBCH0J9VA8KGv9f351kzKqiVP88JI5Qj5qRYfFeli7pNyARfmHQdpJhHM+ZJt/zb1l s63BuZGl9nsJ6LFTDoiZnzkNQu+A4TZM7N36wcW7JN1ZYoQWVnqX6KPfsg0slA9DTBjB +2Lg== X-Gm-Message-State: AOJu0Yzqfc3az61Owj7Nts9SSj8m1mUQxx57KnnQIYPPIdsp5rX4YjEP MmF6ZQfkCqF3jaqWmGuSmEqm6f9SiBIA7xnZMPgKyLlqhvEKjnGnUGoC3JsAj0VCOt+4jnJJxFx Bqf1f1FSoh+dKXpK0C31k6mLXMmk= X-Received: by 2002:a05:6870:f78f:b0:214:8451:7da2 with SMTP id fs15-20020a056870f78f00b0021484517da2mr1019956oab.2.1706280379414; Fri, 26 Jan 2024 06:46:19 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240125235723.39507-1-vinicius.gomes@intel.com> <20240125235723.39507-2-vinicius.gomes@intel.com> In-Reply-To: <20240125235723.39507-2-vinicius.gomes@intel.com> From: Amir Goldstein Date: Fri, 26 Jan 2024 16:46:08 +0200 Message-ID: Subject: Re: [RFC v2 1/4] cleanup: Fix discarded const warning when defining guards To: Vinicius Costa Gomes Cc: brauner@kernel.org, hu1.chen@intel.com, miklos@szeredi.hu, malini.bhandaru@intel.com, tim.c.chen@intel.com, mikko.ylinen@intel.com, lizhen.you@intel.com, linux-unionfs@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, Jan 26, 2024 at 1:57=E2=80=AFAM Vinicius Costa Gomes wrote: > > When defining guards for const types the void* return implicitly > discards the const modifier. Be explicit about it. > > Compiler warning (gcc 13.2.1): > > ./include/linux/cleanup.h:154:18: warning: return discards =E2=80=98const= =E2=80=99 qualifier from pointer target type [-Wdiscarded-qualifiers] > 154 | { return *_T; } > | ^~~ > ./include/linux/cred.h:193:1: note: in expansion of macro =E2=80=98DEFINE= _GUARD=E2=80=99 > 193 | DEFINE_GUARD(cred, const struct cred *, _T =3D override_creds_lig= ht(_T), > | ^~~~~~~~~~~~ > I did not look closely, but can't you use DEFINE_LOCK_GUARD_1()? Thanks, Amir.