Received: by 2002:a05:7412:e794:b0:fa:551:50a7 with SMTP id o20csp1321216rdd; Wed, 10 Jan 2024 16:15:43 -0800 (PST) X-Google-Smtp-Source: AGHT+IFVdOKXaitUQeQQrB+qJL8uxQgw0oVW6xMw/Wh6QaFxbSvAWkt/GbZUoi5TrQYWnKof4t82 X-Received: by 2002:a05:6214:23cc:b0:67f:568d:2914 with SMTP id hr12-20020a05621423cc00b0067f568d2914mr321196qvb.46.1704932142785; Wed, 10 Jan 2024 16:15:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704932142; cv=none; d=google.com; s=arc-20160816; b=Expc9msogTTCkye+BdNng1OqMC4la4079Wf5TYMKUG0U03z0SQsMk6V19grScD/IcZ TB910z4ewE7+Qsl2zAMqMojBDl0JX+ggOh7waEGdzjYpAsX3d8+06BFLj2iTeWG9rxb6 946R2NNcjwkCuo09BoUCIcgt8sYG3EGpAL7G4dah7sHvEVgx/03WWsvus/sWz73+tPb7 QdSsmRD0DH3RP3tNYISvsZb9+M0bcnB8RSBiejmciMfOtjON1HA+XbC7NZ3lwuDG3GBw JTUHoA6QBxnBzr6CuwWE2i6F1GorRabPgG7W5HOn6lyrCpwAAeOZQ20w+cPWQiYLkqFP fZVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=L956n0qI7eMoQ9LeBFrRDOVKdOpf1Z3wRlhs+uI//gs=; fh=MjTvUAK+TEbHdMBRb7PHeNLzFnCGyod8Cn61xlEgEIc=; b=uRcn5KPJx/KFa17NeoT1mQUlEnjrVR5O5QLLURtcbz7jgwUYhQdpaThrbf2GvWSnQm WN++X0P5/f0stFsoTRxgDF3TgFhE6oyje3yyNMdziQPof26yhrQl9nPpuVyyQGP6KplR zC8s92yzW89SlgdD7bYqu8jhRT66IbygIaUJA6yVxfXHRW2fNsXsyiRbIaTkQNtHZnBo ifdC9Y3v3nC9LTapDd8TtqwL79ri9yfiyw6nnQ47tJDZnkUuWzmZ/ICX5kJ+6v3B235w wVm5OwyzqtBqJjy/2GB1K+0W2KeL2gQwvLs2xUb4AxpYGXvZYbdsw4h/Sa79F/qw3AHi sjbA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=pk18AGWz; spf=pass (google.com: domain of linux-kernel+bounces-22908-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-22908-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.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 f19-20020a0caa93000000b0068028d3a03csi5549812qvb.152.2024.01.10.16.15.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Jan 2024 16:15:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-22908-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=@bootlin.com header.s=gm1 header.b=pk18AGWz; spf=pass (google.com: domain of linux-kernel+bounces-22908-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-22908-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.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 8973D1C228D8 for ; Thu, 11 Jan 2024 00:15:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0996836A; Thu, 11 Jan 2024 00:15:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="pk18AGWz" Received: from relay1-d.mail.gandi.net (relay1-d.mail.gandi.net [217.70.183.193]) (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 1DA8718F for ; Thu, 11 Jan 2024 00:15:32 +0000 (UTC) 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 Received: by mail.gandi.net (Postfix) with ESMTPSA id B1F6B240003; Thu, 11 Jan 2024 00:15:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1704932125; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=L956n0qI7eMoQ9LeBFrRDOVKdOpf1Z3wRlhs+uI//gs=; b=pk18AGWzv7CtCKJ4ALrIYofo0V0sitodrffpsHo79GpHrr4gs0ALx/cjRscWDBMd4zIpAU +ewsqokLP8V+yQ1ByPEnaXggblDGR40x6/r7W4KJT4vyPqZr+K/ctsQTBohGqX4OSZXISb LkEG2eT9qzWhE4ZygoHzWyXPSuy3vQZJ3il8grd+PWe0+FeFCj36ntHzkXWK3aBiiqWleA IPfuR8iq92qe1Mhbby9/o7UlgjctwvXlVYSDtKCNs1TH1JR/mX5R8qKDbVBHf/geyq3neu UDkRVOZv44eyO4okI4SI606q6RoUCGl29mF5A3QqoSVTulbs5kFmYrL2zbyhSw== Date: Thu, 11 Jan 2024 01:15:23 +0100 From: Alexandre Belloni To: Frank Li Cc: conor.culhane@silvaco.com, imx@lists.linux.dev, joe@perches.com, linux-i3c@lists.infradead.org, linux-kernel@vger.kernel.org, miquel.raynal@bootlin.com, zbigniew.lukwinski@linux.intel.com Subject: Re: [PATCH 1/1] i3c: master: svc: return error when read length bigger than 255 Message-ID: <20240111001523f69f6a29@mail.local> References: <20240110222503.2381599-1-Frank.Li@nxp.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240110222503.2381599-1-Frank.Li@nxp.com> X-GND-Sasl: alexandre.belloni@bootlin.com On 10/01/2024 17:25:03-0500, Frank Li wrote: > RDTERM in MCTRL is 8 bits. Add a length check to prevent silent data errors > when the read length exceeds 255 bytes during each i3c_priv_xfer operation. > > Signed-off-by: Frank Li > --- > drivers/i3c/master/svc-i3c-master.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/drivers/i3c/master/svc-i3c-master.c b/drivers/i3c/master/svc-i3c-master.c > index bd10bb698da0f..181b56953fb28 100644 > --- a/drivers/i3c/master/svc-i3c-master.c > +++ b/drivers/i3c/master/svc-i3c-master.c > @@ -1375,6 +1375,11 @@ static int svc_i3c_master_priv_xfers(struct i3c_dev_desc *dev, > cmd->len = xfers[i].len; > cmd->actual_len = xfers[i].rnw ? xfers[i].len : 0; > cmd->continued = (i + 1) < nxfers; > + > + if (cmd->rnw && cmd->len > 255) { > + dev_err(master->dev, "only support read less than 255 each xfer\n"); What would be the end user action upon seeing this message? Is it actually useful? > + return -EINVAL; > + } > } > > mutex_lock(&master->lock); > -- > 2.34.1 > -- Alexandre Belloni, co-owner and COO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com