Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp2733863rdg; Mon, 16 Oct 2023 13:10:29 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEy1pFHnS2uS1nfLRjyxEreR6+dvmsXnz2imq+zZAa4pITOZgXK1n3erdYvJYAG7Du0WBC/ X-Received: by 2002:a17:90a:d90c:b0:27d:4b71:ed17 with SMTP id c12-20020a17090ad90c00b0027d4b71ed17mr187021pjv.29.1697487029603; Mon, 16 Oct 2023 13:10:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697487029; cv=none; d=google.com; s=arc-20160816; b=1Fi1DV3YlJJ7OqWH6r64V4zBVutRY3FdkaWCbPE/panK0uWcTubbF4iSkpocfqQFxm CvZOeg/Kl8P+3BLo/nEpz8dq4EfEadGjwo/BAI12ODd9sUsXDylEMtuE1raAmMMREvs2 ZuDaUscaZEgLJiC+gjUKa23kwiGEpsefDMaaTSTGFJKzVoOXQdAZquXcme5Tm8BM/+xP QAOowcqF1cZBtP5zBykTqdITM4vhyyxPWJTmjA+tSSmIgXu6caDTcYGGem34RUoKrCJr JvRW7QrnEb2AjZQNKcYclxvNqusRX5ExoCG8JZ1tO2RZMErbYgdDW33Z4ZXSPPC3JiP9 TZvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=wNErnmPH6DniX5T83v2SYH6J9PNzzIJ8EP+Cl5XQJXY=; fh=cZYYZGAzqpwvBzDKi5JPWQdWjT9OQYTcuiZ+iPZToP4=; b=n48BIryBhC3WG/yJW9fEtbwQnDMBmf+vuE2T4oKfJybI/LnA3LqpEBDh9VwXY2AY59 Hz26cR0ETDa66nDpl3Ca9FvTpoweoGAafOnzI/6SdhnAvurgahQjxhNVK+4M3LZXO63+ 3k4JOr0m9ViC2XGPXRv55IFntG4vNx4KHxcHXGLrXaLIJ+N8K2KoJ/62YEcf4z66VyY0 wqBSNOsFULIjp91MEs/j7DxVThpvu+MxrRgqtfpi2/pZwhnSPDIU1UkLX5jr4cPbqbDe KB6zLtovP/ym/rTFOrqrZVsA9gbdvHbPJdmJA6ny05IFlpZjim4K75dWi9Zflq6LEbwx MOtA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=SHWV1KIh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 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 morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id 80-20020a630253000000b005ac08e723f0si80178pgc.10.2023.10.16.13.10.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 13:10:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=SHWV1KIh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 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 morse.vger.email (Postfix) with ESMTP id 7FE7A8020DAA; Mon, 16 Oct 2023 13:10:27 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232896AbjJPUKV (ORCPT + 99 others); Mon, 16 Oct 2023 16:10:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56868 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231221AbjJPUKU (ORCPT ); Mon, 16 Oct 2023 16:10:20 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A9AE9B0 for ; Mon, 16 Oct 2023 13:10:18 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 542AFC433C8; Mon, 16 Oct 2023 20:10:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1697487018; bh=IP5/MhvOpJ22HR71PavNc9y5Lf1zUiBmMsVX1ID6KQ8=; h=From:To:Cc:Subject:Date:From; b=SHWV1KIhS0Yb/wjRj3WQ40LVlhMleM5nkDCeZsHluZwuliokMnSM9uUwBHXjTZvF0 pmUYwySK4LPu0w5Dx5ic4Kbv3fejLNKmPi7LNvJM+BSkzuU/9G4oWUNwU2oqI2z8Aw pSZ4fIx0PfSrNM7cdS8zbPzuj1fiUHLDmNYqcSC09BfoYgJWu3U31IEbDRu8423NvU EDvPeNIbenW5x4qughRz//+E4TSzKr0RhFXphJbiO7sr6pfoMJBwmDSf+TZryOQtgw jGVqKrGL3EuQ/Pu/I48WX2Ij5kITGsyNiluM5wwGYpcAl223Otnl2tyRcY8GKVH9S9 nkhKNxCu14y4A== From: Arnd Bergmann To: Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Tvrtko Ursulin , David Airlie , Daniel Vetter , Badal Nilawar , Ashutosh Dixit Cc: Arnd Bergmann , Matt Roper , Vinay Belgaumkar , intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH] drm/i915/mtl: avoid stringop-overflow warning Date: Mon, 16 Oct 2023 22:10:04 +0200 Message-Id: <20231016201012.1022812-1-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email 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 (morse.vger.email [0.0.0.0]); Mon, 16 Oct 2023 13:10:27 -0700 (PDT) From: Arnd Bergmann The newly added memset() causes a warning for some reason I could not figure out: In file included from arch/x86/include/asm/string.h:3, from drivers/gpu/drm/i915/gt/intel_rc6.c:6: In function 'rc6_res_reg_init', inlined from 'intel_rc6_init' at drivers/gpu/drm/i915/gt/intel_rc6.c:610:2: arch/x86/include/asm/string_32.h:195:29: error: '__builtin_memset' writing 16 bytes into a region of size 0 overflows the destination [-Werror=stringop-overflow=] 195 | #define memset(s, c, count) __builtin_memset(s, c, count) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/gpu/drm/i915/gt/intel_rc6.c:584:9: note: in expansion of macro 'memset' 584 | memset(rc6->res_reg, INVALID_MMIO_REG.reg, sizeof(rc6->res_reg)); | ^~~~~~ In function 'intel_rc6_init': Change it to an normal initializer and an added memcpy() that does not have this problem. Fixes: 4bb9ca7ee0745 ("drm/i915/mtl: C6 residency and C state type for MTL SAMedia") Signed-off-by: Arnd Bergmann --- drivers/gpu/drm/i915/gt/intel_rc6.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/i915/gt/intel_rc6.c b/drivers/gpu/drm/i915/gt/intel_rc6.c index 8b67abd720be8..7090e4be29cb6 100644 --- a/drivers/gpu/drm/i915/gt/intel_rc6.c +++ b/drivers/gpu/drm/i915/gt/intel_rc6.c @@ -581,19 +581,23 @@ static void __intel_rc6_disable(struct intel_rc6 *rc6) static void rc6_res_reg_init(struct intel_rc6 *rc6) { - memset(rc6->res_reg, INVALID_MMIO_REG.reg, sizeof(rc6->res_reg)); + i915_reg_t res_reg[INTEL_RC6_RES_MAX] = { + [0 ... INTEL_RC6_RES_MAX - 1] = INVALID_MMIO_REG, + }; switch (rc6_to_gt(rc6)->type) { case GT_MEDIA: - rc6->res_reg[INTEL_RC6_RES_RC6] = MTL_MEDIA_MC6; + res_reg[INTEL_RC6_RES_RC6] = MTL_MEDIA_MC6; break; default: - rc6->res_reg[INTEL_RC6_RES_RC6_LOCKED] = GEN6_GT_GFX_RC6_LOCKED; - rc6->res_reg[INTEL_RC6_RES_RC6] = GEN6_GT_GFX_RC6; - rc6->res_reg[INTEL_RC6_RES_RC6p] = GEN6_GT_GFX_RC6p; - rc6->res_reg[INTEL_RC6_RES_RC6pp] = GEN6_GT_GFX_RC6pp; + res_reg[INTEL_RC6_RES_RC6_LOCKED] = GEN6_GT_GFX_RC6_LOCKED; + res_reg[INTEL_RC6_RES_RC6] = GEN6_GT_GFX_RC6; + res_reg[INTEL_RC6_RES_RC6p] = GEN6_GT_GFX_RC6p; + res_reg[INTEL_RC6_RES_RC6pp] = GEN6_GT_GFX_RC6pp; break; } + + memcpy(rc6->res_reg, res_reg, sizeof(res_reg)); } void intel_rc6_init(struct intel_rc6 *rc6) -- 2.39.2