Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp7166578rdb; Wed, 3 Jan 2024 06:49:36 -0800 (PST) X-Google-Smtp-Source: AGHT+IF5rDZ6lDIXfTyo3k4JnflMYf3Sns+ctwydqjvJKf3nRvwScM8F8xL3t6UEA2enerr0r10c X-Received: by 2002:a25:1f02:0:b0:dbe:a081:97af with SMTP id f2-20020a251f02000000b00dbea08197afmr632129ybf.126.1704293376110; Wed, 03 Jan 2024 06:49:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704293376; cv=none; d=google.com; s=arc-20160816; b=dlo8PwT8zIGYwwIduJbuOW+5Hb2PnUyGaLctQvW7/jlSVpMwmZ64IjJAPjJefh4Sby v6mCuMUTNQ08e13QhShyUwhRqs9G7dbYDyv0+TtebJUrPho+DjMdJmdOrr22fqKUsEJd KeGm9VxTe3glMpmXh/XvcPeMTN8u8ER++3sOux5fFuzHlG30RML0uNmvE1W4jNgxkO3e cJDv8NQpkFF3tqLMlD5EGIbFCyhHgJpU8Kcpnu8lEo0g3J+bF6WIjCYOJ434Zq61fnFi rCy8Js2G4VAfDgRRkXCtVqdeJUNUsjBt+hn1qMeGe7/j9UYC/IQTOSUuKWySQh9DkmKb rGkA== ARC-Message-Signature: i=1; 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=ufp4vRBdchU/yun+kCRIt0+8UCXvzfiwI6xueBPpbEo=; fh=2+wor8OWApqFKl1NM5MS0p+R1vLCXD+pbdIcfGPqnOk=; b=LC/abA0osxJULWWX7zH819/z2TKzZCNWIpmHw2gyiry4+2y1IoRVtptJgr5rJbDrXt zvEPr6NL45VqvVnoaz/baQ4AGLdaWtz58B/2NbQqi2CSQhS9pG8YxFEVgCz+D/dCB139 fvJ4X04nkkNsJHGLLxoJRgPE4in8aVy+NCDhEOGR2t7lc1oyRBEiex4X/1Lv2tJXot1T 6xHlyIVFA9OAZ/5xGuchdYXEIsVFf3Kb9iQcF4BdV1fwkYL3kjD+NZk8ZTG4mj3kygoq sohq2nK6qhtIl2b0xTMDNCitkm9t0sVWLG+W2JPNLv5Tm1VNapJD+hIGtMe4ZXKWFNod W9mg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="G0N/xyR3"; spf=pass (google.com: domain of linux-kernel+bounces-15667-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-15667-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id y12-20020a05622a120c00b00427ec76585bsi16067968qtx.735.2024.01.03.06.49.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jan 2024 06:49:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-15667-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="G0N/xyR3"; spf=pass (google.com: domain of linux-kernel+bounces-15667-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-15667-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id C9F501C2370F for ; Wed, 3 Jan 2024 14:49:35 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 539DC1B26F; Wed, 3 Jan 2024 14:49:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="G0N/xyR3" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-oa1-f49.google.com (mail-oa1-f49.google.com [209.85.160.49]) (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 3B0431A703 for ; Wed, 3 Jan 2024 14:49:15 +0000 (UTC) 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-f49.google.com with SMTP id 586e51a60fabf-204fdd685fdso3955992fac.2 for ; Wed, 03 Jan 2024 06:49:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1704293354; x=1704898154; 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=ufp4vRBdchU/yun+kCRIt0+8UCXvzfiwI6xueBPpbEo=; b=G0N/xyR3WYFE5hor7N2hFpkvflEXmVhOIhesOkXR7gh7BtC05w8da0PcmA10cQ/1l4 EGb39H6Ho4dJ1F4Qz/rZakAAVZMT1667m33NzKnP4sWQ0fyErDeaaLsYMsTN40B8sf6m QZ1R6nrn8RhHZepECfes5vimy0raeCEWbQ0MPtPjDXezyR3D9uYINWkacvQI1+IOVmTB ZtNE/ala5X5KRAOfchxsRaYxUaqXq/eYgDyGfzuqGg86QAa69J7YWdK8bXdBg6gfoims Zd+RF63AzU7zIYrtpOc4Z51SohgYtskDQ4uX6g1hJzwCx9i8Ju9jJB2IvzwFa9CC9bDz 09tg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704293354; x=1704898154; 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=ufp4vRBdchU/yun+kCRIt0+8UCXvzfiwI6xueBPpbEo=; b=RLLhWYWbauf1TDtoeKAbDGK1G/4hyLmvloYYKLIIVCGzt9th9D3yhXH2Vg9J+u2jOl DGHaKhT/v7j9lteSbeDKOCu4SfOlUly29oA6ODjl5OGgEQNaMPSwOp6Vpnz0xE4W16A/ Zan2Q5hm6kOUxGNI5xzyjrkvKWZ+AFHTwebi2vmnsQQ2eJsI1iwVfflWNSF8RCI/yqls q+VChzwdYHQg7Wz283ovSgt5WQZbWFA7TF3X4KmNg/Q58X/M19vIwxFNWX/nCpmd/cOu LPl/B8RJysbpjFMtfpShSK0ILitUrTQg8pgxNdz3/UPsvSO1iIDtmH/dJ2wzqSYfkdM6 Nfbg== X-Gm-Message-State: AOJu0Yy3EM8yTmMXj0tnWxMsxom0L0YU1d2NNgaKgo75uHWb/bAhc0VI LTnMeWOtKdXWwDywHcxOGJUOTCCgkLHbYwuztC8= X-Received: by 2002:a05:6870:c114:b0:1fb:205d:756b with SMTP id f20-20020a056870c11400b001fb205d756bmr27160386oad.19.1704293354292; Wed, 03 Jan 2024 06:49:14 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20231122221421.2944301-1-arnd@kernel.org> <536a5850-34af-4a7d-b65d-82147895ef04@infradead.org> In-Reply-To: <536a5850-34af-4a7d-b65d-82147895ef04@infradead.org> From: Alex Deucher Date: Wed, 3 Jan 2024 09:49:03 -0500 Message-ID: Subject: Re: [PATCH] drm/amd/display: avoid stringop-overflow warnings for dp_decide_lane_settings() To: Randy Dunlap Cc: Arnd Bergmann , Harry Wentland , Leo Li , Rodrigo Siqueira , Alan Liu , Srinivasan Shanmugam , Arnd Bergmann , Qingqing Zhuo , "Pan, Xinhui" , Wenjing Liu , linux-kernel@vger.kernel.org, amd-gfx@lists.freedesktop.org, Michael Mityushkin , Michael Strauss , dri-devel@lists.freedesktop.org, Daniel Vetter , George Shen , Alex Deucher , Jun Lei , David Airlie , =?UTF-8?Q?Christian_K=C3=B6nig?= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Applied. Thanks! On Mon, Dec 25, 2023 at 5:30=E2=80=AFAM Randy Dunlap wrote: > > > > On 11/22/23 14:13, Arnd Bergmann wrote: > > From: Arnd Bergmann > > > > gcc prints a warning about a possible array overflow for a couple of > > callers of dp_decide_lane_settings() after commit 1b56c90018f0 ("Makefi= le: > > Enable -Wstringop-overflow globally"): > > > > drivers/gpu/drm/amd/amdgpu/../display/dc/link/protocols/link_dp_trainin= g_fixed_vs_pe_retimer.c: In function 'dp_perform_fixed_vs_pe_training_seque= nce_legacy': > > drivers/gpu/drm/amd/amdgpu/../display/dc/link/protocols/link_dp_trainin= g_fixed_vs_pe_retimer.c:426:25: error: 'dp_decide_lane_settings' accessing = 4 bytes in a region of size 1 [-Werror=3Dstringop-overflow=3D] > > 426 | dp_decide_lane_settings(lt_settings, dp= cd_lane_adjust, > > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~= ~~~~~~~~~~~~~~~ > > 427 | lt_settings->hw_lane_se= ttings, lt_settings->dpcd_lane_settings); > > | ~~~~~~~~~~~~~~~~~~~~~~~= ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > drivers/gpu/drm/amd/amdgpu/../display/dc/link/protocols/link_dp_trainin= g_fixed_vs_pe_retimer.c:426:25: note: referencing argument 4 of type 'union= dpcd_training_lane[4]' > > > > I'm not entirely sure what caused this, but changing the prototype to e= xpect > > a pointer instead of an array avoids the warnings. > > > > Fixes: 7727e7b60f82 ("drm/amd/display: Improve robustness of FIXED_VS l= ink training at DP1 rates") > > Signed-off-by: Arnd Bergmann > > > Acked-by: Randy Dunlap > Tested-by: Randy Dunlap # build-tested > > Thanks. > > > --- > > .../gpu/drm/amd/display/dc/link/protocols/link_dp_training.c | 2 +- > > .../gpu/drm/amd/display/dc/link/protocols/link_dp_training.h | 2 +- > > 2 files changed, 2 insertions(+), 2 deletions(-) > > > > diff --git a/drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_trai= ning.c b/drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_training.c > > index 90339c2dfd84..5a0b04518956 100644 > > --- a/drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_training.c > > +++ b/drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_training.c > > @@ -807,7 +807,7 @@ void dp_decide_lane_settings( > > const struct link_training_settings *lt_settings, > > const union lane_adjust ln_adjust[LANE_COUNT_DP_MAX], > > struct dc_lane_settings hw_lane_settings[LANE_COUNT_DP_MA= X], > > - union dpcd_training_lane dpcd_lane_settings[LANE_COUNT_DP= _MAX]) > > + union dpcd_training_lane *dpcd_lane_settings) > > { > > uint32_t lane; > > > > diff --git a/drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_trai= ning.h b/drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_training.h > > index 7d027bac8255..851bd17317a0 100644 > > --- a/drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_training.h > > +++ b/drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_training.h > > @@ -111,7 +111,7 @@ void dp_decide_lane_settings( > > const struct link_training_settings *lt_settings, > > const union lane_adjust ln_adjust[LANE_COUNT_DP_MAX], > > struct dc_lane_settings hw_lane_settings[LANE_COUNT_DP_MAX], > > - union dpcd_training_lane dpcd_lane_settings[LANE_COUNT_DP_MAX]); > > + union dpcd_training_lane *dpcd_lane_settings); > > > > enum dc_dp_training_pattern decide_cr_training_pattern( > > const struct dc_link_settings *link_settings); > > -- > #Randy > https://people.kernel.org/tglx/notes-about-netiquette > https://subspace.kernel.org/etiquette.html