From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtpout-04.galae.net (smtpout-04.galae.net [185.171.202.116]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 34A7039F193; Sat, 30 May 2026 13:38:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.171.202.116 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780148303; cv=none; b=YXjqTgklHxhLGVS4sIYBQu/3tj5KjZJcvRxCBVYjOiet5juNAh5DdTL+hbl6h8+zXpjyevOiF6QhqjodS8fFisSGDt7tHP2fK/c/EwOPIVQOvt22l7yDcxXiEEG/WrChM7n3DeOh3lBmyJ+5jpVmmfp0DBtxzQWcGg6aih48hzc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780148303; c=relaxed/simple; bh=wMOHpweu08FPAJHq4AE/oNWvwNOAd0wQwSZ/JG6jpNE=; h=Mime-Version:Content-Type:Date:Message-Id:To:From:Subject:Cc: References:In-Reply-To; b=Oe6nfc83eaUM/f6tj1Cim3gsWD2gofunVWak7+M1pFZWAYaED0Qcap9VHgYeVgTU/95XNvG8HyE2lBnLGh99pFPUO3cgYiFGZMMxzpHj6MZS1/IGRIXUVvQCnwyGqCgoU2l51ND4+MjeyX9sVFYwNi0b3G1eVXQU+nDfpuBRmdk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=0Ec7yLjH; arc=none smtp.client-ip=185.171.202.116 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="0Ec7yLjH" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-04.galae.net (Postfix) with ESMTPS id 95B0EC6246B; Sat, 30 May 2026 13:38:21 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 490586073B; Sat, 30 May 2026 13:38:20 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id C663610888CC8; Sat, 30 May 2026 15:38:07 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1780148298; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=HKrIBJHZD91OGHEHVz5icU8jb2dXEwclJl95UpuDS+U=; b=0Ec7yLjHV7F3GfRWpGS/Jh45rOIY/RCXZ6DwjKTCVXMkdaD1xzjp6Y9XyRUkjyFtFZfuOF 3P9QhCvry/SyDVW4RyYe/KaOzIrbL6MJgGDQ/YmLYcItXJI0fH33gfSrAON6P+dq6a/m3r JZRwfZNaYNZNdiyb5cMRN007pFtXOz6LowX1oNqXurum5rFfxcHPTmmIvDzdTI8XOanlfZ cTlS4RLyJ1pv0NiT+gTpGvH4u+J6JRbm5ElJ++gnZLG/8jfkzAjakCKu/hZBH91W3Ga5nu ybQ4NtweDzYbPMWJAs2u08gXQlqMmVNoiygSG7yri/prWlXLGR5JTurKvIYDRw== Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Sat, 30 May 2026 15:38:05 +0200 Message-Id: To: "Luca Ceresoli" , "Damon Ding" From: "Luca Ceresoli" Subject: Re: [PATCH v4 2/3] drm/bridge: analogix_dp: Add validation for samsung,lane-count property Cc: , , , , , , , , , , , , , , , , , , , , , , , , , , , X-Mailer: aerc 0.21.0 References: <20260529040530.741336-1-damon.ding@rock-chips.com> <20260529040530.741336-3-damon.ding@rock-chips.com> <178014803941.21632.16225608049285101452.b4-review@b4> In-Reply-To: <178014803941.21632.16225608049285101452.b4-review@b4> X-Last-TLS-Session-Version: TLSv1.3 On Sat May 30, 2026 at 3:33 PM CEST, Luca Ceresoli wrote: > On Fri, 29 May 2026 12:05:29 +0800, Damon Ding wrote: > > Hello Damon, > >> >> diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c b/driver= s/gpu/drm/bridge/analogix/analogix_dp_core.c >> index 8cf6b73bceac..699a7f380c56 100644 >> --- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c >> +++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c >> @@ -1260,8 +1261,16 @@ static int analogix_dp_dt_parse_pdata(struct anal= ogix_dp_device *dp) >> */ >> of_property_read_u32(dp_node, "samsung,link-rate", >> &video_info->max_link_rate); >> - of_property_read_u32(dp_node, "samsung,lane-count", >> - &video_info->max_lane_count); >> + ret =3D of_property_read_u32(dp_node, "samsung,lane-count", >> + &video_info->max_lane_count); >> + if (!ret) { >> + if (video_info->max_lane_count =3D=3D 0 || >> + video_info->max_lane_count > LANE_COUNT4) { > > This sashiko report seems to me valid. Meh, messed up with 'b4 review' :-/ Apologies "This sashiko report" [0] was about an enum being signed, so '=3D=3D 0' cou= ld miss negative numbers coming from bogus DT values higher than 1^31. > > But I'n no DP expert, I have no idea whether this ther one is valid. And this was about "Additionally, does this check inadvertently allow 3, which is an invalid DisplayPort lane count?" >> + dev_err(dp->dev, "samsung,lane-count =3D %d is out of range\n", >> + video_info->max_lane_count); >> + return -EINVAL; >> + } >> + } > > As reported by sashiko, 'count =3D=3D 0' should be 'count <=3D 0', being = an enum. > > Additionally I'd avoid the nested if, and I think using dev_err_probe() i= s > correct here (we are only called by probe functions), so it all could > become: > > if (ret || count <=3D 0 || count > LANE_COUNT0) > return dev_err_probe(...); > > There are other sashiko reports to patch 3, and at least one seems valid = to > me. Can you either fix them in the next iteration or elaborate on why the > code is correct there? > > Thanks! [0] https://sashiko.dev/#/patchset/20260529040530.741336-1-damon.ding%40roc= k-chips.com Luca -- Luca Ceresoli, Bootlin Embedded Linux and Kernel engineering https://bootlin.com