Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp236514pxb; Wed, 15 Sep 2021 00:26:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwOTJJPL66GATYCm2fdIPO+s/N/eNsvX33JNdk7tuWEPK02m8Faa0vp89EJ6HgTyRA5K5ZJ X-Received: by 2002:a05:6512:982:: with SMTP id w2mr16970075lft.112.1631690791680; Wed, 15 Sep 2021 00:26:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631690791; cv=none; d=google.com; s=arc-20160816; b=T5lsP2ZoJ7Y0EdiBYiwmuEfZifVAbtMEsqous4sZE8/hbq2/g23LGtQ9RX971VtN2I GB5SVN8RLx2KPA50+4E50JcDfTz7GKfPBauyVHbnzAmnRvV6WqDa63vkAHurRQlltNPg yL0zQYmUZj7FTZTjZH3iqoV4NyiqxkSP5OCufaqMeHGXzpxuFHlok6yLm05FGD3O9Kn6 SeNez1FLGzN/DNNgUU/0YQChw+lUWIS/gZ5X9mkP1YHdtnA/fL3IF4E7GUWaVzKwMyzN cKZWG+26k2hZeAEISAscniaJxZbXLGfzB//XlnkG4ldUCTj1Lvgm408MCH1v6PWxfzrT b9Pg== 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; bh=zJhQWxsxvRursFQR006eQWpzNVdbO+eQu/FfyTgUasM=; b=RcDE3Yn8VLQzfKut9sCdEfMUhGvSiWyknsOq+lLMjfb4JKArWgAG1kXNaEuN/2syKR 5gg3JwCX7d4ETsYHukmlu3LrhDPqXgHTsiiqdyNXUfX2V/NoNr/H/7uZc6g59Z+MX9IM 2D3eoKHZAUbijnH51XgLFYv9PYzssRTeZmq7MTCesQ7nWMdu1+SOfeJqfVi+jmczTfu/ u0TYUQUwFFVGYg7ylHXWE2oRVQRI8hmMX/r0ne1CLofdD/XBd5Lpw8ehZ5sLIHPJh30r xtq33fLEOXg/ViYTGTAOwa7nMn13PXBVZyCUoU8p4zz33WPsR2nEIwrnZzXjj8ixFUzJ 9dNQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r4si16959227lfc.221.2021.09.15.00.26.04; Wed, 15 Sep 2021 00:26:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236668AbhIOHY0 (ORCPT + 99 others); Wed, 15 Sep 2021 03:24:26 -0400 Received: from mga11.intel.com ([192.55.52.93]:45245 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236486AbhIOHYZ (ORCPT ); Wed, 15 Sep 2021 03:24:25 -0400 X-IronPort-AV: E=McAfee;i="6200,9189,10107"; a="219060255" X-IronPort-AV: E=Sophos;i="5.85,294,1624345200"; d="scan'208";a="219060255" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Sep 2021 00:23:07 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.85,294,1624345200"; d="scan'208";a="610053522" Received: from kuha.fi.intel.com ([10.237.72.162]) by fmsmga001.fm.intel.com with SMTP; 15 Sep 2021 00:23:04 -0700 Received: by kuha.fi.intel.com (sSMTP sendmail emulation); Wed, 15 Sep 2021 10:23:04 +0300 Date: Wed, 15 Sep 2021 10:23:04 +0300 From: Heikki Krogerus To: Sven Peter Cc: Greg Kroah-Hartman , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 3/3] usb: typec: tipd: Remove WARN_ON in tps6598x_block_read Message-ID: References: <20210914140235.65955-1-sven@svenpeter.dev> <20210914140235.65955-3-sven@svenpeter.dev> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210914140235.65955-3-sven@svenpeter.dev> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Sep 14, 2021 at 04:02:35PM +0200, Sven Peter wrote: > Calling tps6598x_block_read with a higher than allowed len can be > handled by just returning an error. There's no need to crash systems > with panic-on-warn enabled. > > Signed-off-by: Sven Peter Reviewed-by: Heikki Krogerus > --- > v1 -> v2: > - added this patch to also remove the WARN_ON in tps6598x_block_read > as suggested by greg k-h > > drivers/usb/typec/tipd/core.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/usb/typec/tipd/core.c b/drivers/usb/typec/tipd/core.c > index 8c79ba17a157..93e56291f0cf 100644 > --- a/drivers/usb/typec/tipd/core.c > +++ b/drivers/usb/typec/tipd/core.c > @@ -117,7 +117,7 @@ tps6598x_block_read(struct tps6598x *tps, u8 reg, void *val, size_t len) > u8 data[TPS_MAX_LEN + 1]; > int ret; > > - if (WARN_ON(len + 1 > sizeof(data))) > + if (len + 1 > sizeof(data)) > return -EINVAL; > > if (!tps->i2c_protocol) > -- > 2.25.1 thanks, -- heikki