Received: by 2002:a05:7412:6592:b0:d7:7d3a:4fe2 with SMTP id m18csp1225856rdg; Fri, 11 Aug 2023 14:10:39 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHNLmQ0jxVzELqFVHXcVUU3OXvAiLjDWagpUa68jLM5gI2pAK640Y37cNOCTHBAgsDjJTJs X-Received: by 2002:a05:6a21:3b48:b0:131:6464:2178 with SMTP id zy8-20020a056a213b4800b0013164642178mr3883013pzb.21.1691788239187; Fri, 11 Aug 2023 14:10:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691788239; cv=none; d=google.com; s=arc-20160816; b=nWtlw6X4XJTYxwG7g4KPiOji41yDSr7/OoGg03mAeKV07RB/fPfBOlA9stwtUgizEE RFv3e4qtShnVQww4MOcLIuk02NwA92fTmsxdxj4Sp7uu6jpELH0sq8zM+h6ZeVzRGLIj U3RipgM6jCn0XnaIroFgO5QN/7bhOeFN5Y/DdItYKmyt2ZenkweXynKe9g173K4nM7h2 rIMZu2qQHZEKjpBQc6Dk2KwBWiBI//mv/0WoxEp4IuXF1VhLGls2Oc5kJfpbDD5tiuuN irsOBjTvj1GvlVt6c4BH3p3SZSzvtVarhr+h3PkYKxscCeKYzHMB9pm55vDpvnYZ9APp 6uJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:reply-to:message-id:subject:cc:to:from:date:sender :dkim-signature; bh=0UbK4nnymHvPms4qLxQwbH3NM35gMPbEu4WBWUEgE1g=; fh=CGuradeu32K992C5dKF3NZmBoA2Cw0bkrKN9AzwvWlA=; b=JY9/Z2GcdIFcK/K5iq3Cw/z1EekRIZKPnCmmEBbrrY8bjQtd/QNuLx5Jwho42aiUY1 QAA8AKRU8pWH6PO8FRlO+JrB+X/S8i5DO1Uc614jrrat1S/tEp9uPw7tjR73/BEwdkOG MqZ2cuEnlPcuM4f7dParRDioZI8iURojmcj4bTeVngQamERMIum/bXH+fPiZtiB4t+XQ 3myR+2BA0EL8mf8OliSAIkpuaWoFwkNcSZfgvfm6DPngzhU/Yz9aNhcF6XPTu3Or4M6o KEcbkvPKWhXGWnCumrMkrxN1C+HwJfZGgOKP0uKFlvpivWG2Bunzt7JdQSuf/+PBFhjw 3W6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=o7DUElap; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=acm.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a17-20020a63e411000000b00564d6ad2746si3804364pgi.452.2023.08.11.14.10.27; Fri, 11 Aug 2023 14:10:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=o7DUElap; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=acm.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235392AbjHKU13 (ORCPT + 99 others); Fri, 11 Aug 2023 16:27:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46706 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235141AbjHKU12 (ORCPT ); Fri, 11 Aug 2023 16:27:28 -0400 Received: from mail-yw1-x1133.google.com (mail-yw1-x1133.google.com [IPv6:2607:f8b0:4864:20::1133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0266310F for ; Fri, 11 Aug 2023 13:27:28 -0700 (PDT) Received: by mail-yw1-x1133.google.com with SMTP id 00721157ae682-586a684e85aso25788847b3.2 for ; Fri, 11 Aug 2023 13:27:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1691785647; x=1692390447; h=in-reply-to:content-disposition:mime-version:references:reply-to :message-id:subject:cc:to:from:date:sender:from:to:cc:subject:date :message-id:reply-to; bh=0UbK4nnymHvPms4qLxQwbH3NM35gMPbEu4WBWUEgE1g=; b=o7DUElapNyvjmyACrVVOC7+p6ZhVxbT+HsfcVJ6xyq28u+Dhi7Ru9ReuEGNdkOyFnU XjZSESoC1/pAOPLHT/2ElG6/JM2ngkQyoiYCdchEJreGZvjKcOwDbB96ctiZwwb1+mzU 8r9ob4k+1OxsY5EIJEKP2Mf9MPF5fNIrjQxdtn2F81CuB3qbEkgMl8Db2dxZ5uiYt2aM a/3s2CUllV78jDpS/UGf/MVZtJN440MTANe5E9lh+3zSMI67qVyueE/IZAXFY5bqAdkr ZdICJj/5Er3Vk0NW4nrHc/J7g1hu124/N9Xockd+puGL6F8r9BcBPH7JJEkkhXfq1uc4 3BVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691785647; x=1692390447; h=in-reply-to:content-disposition:mime-version:references:reply-to :message-id:subject:cc:to:from:date:sender:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=0UbK4nnymHvPms4qLxQwbH3NM35gMPbEu4WBWUEgE1g=; b=aZZ3e96IotvvsL6ObFB+LK86e4vCnVb8WKbbhyJzKJxg0vlI8vEJ+2JWjglaGmu2yC 4vsZh0n4qFPjulYekI6sJV9K2WymjZzfEhgE9b7bgnI+PWNlZH3NmBszNhmDTjVYpHgL 6cNXqVYsOv2tudebNH1dPUi4t1zWgKn5AtDW5lzlzPftYd6KHpbwnZwegmUPyTQdLfIF h78FNBmdIxbTl/Wy8lLbMrQE/UNhPqz4t1eZrPwWlmc+mkHKY3IpGwhQmsR1283jpos0 N2KkYSHXDmYX7aDsadilBSa1sDO/Fuf2oQYnk8f4rt/mjo+t/P73WEypE1pKyh4XP8C7 ZoKg== X-Gm-Message-State: AOJu0YxCV56FvmdRQ/e4099laapmKCDffa1RANQ01Xel6Om/sAjzAO8g JHGef6/loHNWBDYcaAL6Mg== X-Received: by 2002:a0d:f941:0:b0:583:523e:6569 with SMTP id j62-20020a0df941000000b00583523e6569mr2706967ywf.17.1691785647070; Fri, 11 Aug 2023 13:27:27 -0700 (PDT) Received: from serve.minyard.net (serve.minyard.net. [2001:470:b8f6:1b::1]) by smtp.gmail.com with ESMTPSA id y6-20020a818806000000b0057736c436f1sm1203438ywf.141.2023.08.11.13.27.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Aug 2023 13:27:26 -0700 (PDT) Sender: Corey Minyard Received: from mail.minyard.net (unknown [IPv6:2001:470:b8f6:1b:e34a:4ada:ffd0:e7ff]) by serve.minyard.net (Postfix) with ESMTPSA id 5FB071800E8; Fri, 11 Aug 2023 20:27:25 +0000 (UTC) Date: Fri, 11 Aug 2023 15:27:24 -0500 From: Corey Minyard To: Justin Stitt Cc: Nathan Chancellor , Nick Desaulniers , Tom Rix , openipmi-developer@lists.sourceforge.net, linux-kernel@vger.kernel.org, llvm@lists.linux.dev, Arnd Bergmann , kernel test robot Subject: Re: [PATCH] ipmi_si: fix -Wvoid-pointer-to-enum-cast warning Message-ID: Reply-To: minyard@acm.org References: <20230809-cbl-1902-v1-1-92def12d1dea@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230809-cbl-1902-v1-1-92def12d1dea@google.com> X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Aug 09, 2023 at 09:05:17PM +0000, Justin Stitt wrote: > With W=1 we see the following warning: > > | drivers/char/ipmi/ipmi_si_platform.c:272:15: error: \ > | cast to smaller integer type 'enum si_type' from \ > | 'const void *' [-Werror,-Wvoid-pointer-to-enum-cast] > | 272 | io.si_type = (enum si_type) match->data; > | | ^~~~~~~~~~~~~~~~~~~~~~~~~~ > > This is due to the fact that the `si_type` enum members are int-width > and a cast from pointer-width down to int will cause truncation and > possible data loss. Although in this case `si_type` has only a few > enumerated fields and thus there is likely no data loss occurring. > Nonetheless, this patch is necessary to the goal of promoting this > warning out of W=1. > > Link: https://github.com/ClangBuiltLinux/linux/issues/1902 > Link: https://lore.kernel.org/llvm/202308081000.tTL1ElTr-lkp@intel.com/ > Reported-by: kernel test robot > Signed-off-by: Justin Stitt > --- > Note: > Arnd had mentioned that there perhaps may be some semantic differences > between GCC and Clang regarding this warning or family of warnings. For > now, this patch (and others following) will yield less noisy W=1 builds > and hopefully materialize into this warning getting promoted out of W=1 > to an always-on warning. > --- > drivers/char/ipmi/ipmi_si_platform.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/char/ipmi/ipmi_si_platform.c b/drivers/char/ipmi/ipmi_si_platform.c > index 505cc978c97a..0d509d683c0f 100644 > --- a/drivers/char/ipmi/ipmi_si_platform.c > +++ b/drivers/char/ipmi/ipmi_si_platform.c > @@ -269,7 +269,7 @@ static int of_ipmi_probe(struct platform_device *pdev) > } > > memset(&io, 0, sizeof(io)); > - io.si_type = (enum si_type) match->data; > + io.si_type = (unsigned long) match->data; Wouldn't you want to use intptr_t or uintptr_t? -corey > io.addr_source = SI_DEVICETREE; > io.irq_setup = ipmi_std_irq_setup; > > > --- > base-commit: c1a515d3c0270628df8ae5f5118ba859b85464a2 > change-id: 20230809-cbl-1902-7532a747b731 > > Best regards, > -- > Justin Stitt >