Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp2049066rda; Tue, 24 Oct 2023 10:42:07 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFUjt+WKFOZloyZEGavNr5bKoTFGpZTZY1tc9GpyV7DhK8Lwmks/YhfWuHrNiGRcKeRGLef X-Received: by 2002:a17:902:d506:b0:1c2:1068:1f4f with SMTP id b6-20020a170902d50600b001c210681f4fmr13555569plg.17.1698169326730; Tue, 24 Oct 2023 10:42:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698169326; cv=none; d=google.com; s=arc-20160816; b=a8YZ21DWhR/oXabzX0byCtOJopm+6tEVYkTGNNRDEeAksvsLjX83YGcmqJELuVOQk1 fkzJRS+AvbGudjsdabvZZ1j8FRm5DkDiAxzJdmbR8RU7KKG3Gpdy0d2lVqHR98DVigPP CETbWfrgkPzxnJIKme1RFW+zZqOOg83cAxk7T1yNI50SFIdOynjH2XaIYSEZN2b0TzJQ fGHAxFDaemo2FziWUWy3wWurMP+NMoI841bVi7lZtECkV//19BFRIHVUK3QWvrL1gR4/ X8caG+NRwALaVCOaSG2fXyj5hok23Y+Gp7nyHSYuvGvGVH9Hevm3CaqJV8jOMq5NPsSc 7xiw== 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:message-id:subject:cc:to:from:date:dkim-signature; bh=PYkeFtv5S6zal1GbWNailTVVf5PtH880l3p1S75HYxs=; fh=TBr21rstnYS6/6ayn1SYF2PswLlQbffIxpUX2dap+sI=; b=PHG60k6ryAEKa+W0dQYzH4PxXsTM3aXjCtg0L0ArkY5tqpWHZHwdbgUzahxXvYWZbm ehGoHAS8A++ltLwy/HAPdYpOSBNsK+Xknuu+TVeT/WhfVlstxjrNVE/+dxt2Bf7dmarx OfnAEug9KJxuuFvl8hYBvICbt8RFv41kzR/2hPnZQ/haNa1bk8jcAwuRgBYzogIMwh3x ewztTcnF/Ao1yOqWRy4GMVi8fv6nY6XKrv0KPjh26F9YtWmCRUwEK4H3qb4fHmOnJF4S lXM2MTYcB5FeAdfUJtzkJ/LJzzkUIotakGbh9fRDOS1IzDPVoR4IoUk1uhTTocTGNqas WaRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=kole9idD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id u5-20020a170902e5c500b001c32fe6cdf9si8676289plf.386.2023.10.24.10.42.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Oct 2023 10:42:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=kole9idD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id E5DD58029DCC; Tue, 24 Oct 2023 10:42:05 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344074AbjJXRmC (ORCPT + 99 others); Tue, 24 Oct 2023 13:42:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37300 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344077AbjJXRmA (ORCPT ); Tue, 24 Oct 2023 13:42:00 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 618A310D1 for ; Tue, 24 Oct 2023 10:41:58 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 306E8C433C8; Tue, 24 Oct 2023 17:41:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1698169318; bh=TTksDceA+wO0GuVnCGF4HeG429ffyHr6vIFC99gELqo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=kole9idDyEzsBcVajRjH1HVLnr/wnud0s0YxQCybAGeygnTutgBzTIMy0OuiSvaiK FbTxTnHY+bNlvyoALqlF2Yu0jtADBLv3k7LLYpuEegPKbxpeN9J8Hbm4E5TvKPJ4Pc 9bvwII1J2QQM2QX6brHuCxqwz0zskj/Dq6Oo7V0vOPOGkAIB/+5Mwugwg1uzoTlB2b /X/p0Re7GXFBzcNPZSIGCv/KTK9gKj43ua97Jv6TamormI91WSX3nYL4xYxGh94379 XI+5lKMBAFwGU2qzI018uhOdQDyKXwwWgeTQYjeA0bHvbZSBdEbiTQ/tSmcOEOKEuR /IZtV4r7AIVJw== Date: Tue, 24 Oct 2023 19:41:53 +0200 From: Andi Shyti To: Jani Nikula Cc: Arnd Bergmann , Joonas Lahtinen , Rodrigo Vivi , Tvrtko Ursulin , David Airlie , Daniel Vetter , Badal Nilawar , Ashutosh Dixit , Arnd Bergmann , Matt Roper , Vinay Belgaumkar , intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Andi Shyti Subject: Re: [PATCH] drm/i915/mtl: avoid stringop-overflow warning Message-ID: <20231024174153.byeq7ctssvxuwa4z@zenone.zhora.eu> References: <20231016201012.1022812-1-arnd@kernel.org> <87edhlbj16.fsf@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87edhlbj16.fsf@intel.com> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=ham 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Tue, 24 Oct 2023 10:42:06 -0700 (PDT) Hi Jani, > > static void rc6_res_reg_init(struct intel_rc6 *rc6) > > { > > - memset(rc6->res_reg, INVALID_MMIO_REG.reg, sizeof(rc6->res_reg)); > > That's just bollocks. memset() is byte granularity, while > INVALID_MMIO_REG.reg is u32. If the value was anything other than 0, > this would break. Actually it's: void *memset(void *s, int c, size_t count) > And you're not supposed to look at the guts of i915_reg_t to begin with, > that's why it's a typedef. Basically any code that accesses the members > of i915_reg_t outside of its implementation are doing it wrong. > > Reviewed-by: Jani Nikula in any case, I agree with your argument, but why can't we simply do: memset(rc6->res_reg, 0, sizeof(rc6->res_reg)); ? The patch looks to me like it's being more complex that it should. Andi