From patchwork Thu Aug 19 18:09:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rui Miguel Silva X-Patchwork-Id: 499759 Delivered-To: patch@linaro.org Received: by 2002:a02:6f15:0:0:0:0:0 with SMTP id x21csp772638jab; Thu, 19 Aug 2021 11:09:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxBJMR3Vqtz5Ou0Iq57/cTnvOBlY3l24riMw47FgJmnptqRMA/ye1ZUl26QVsG8auZKdMGm X-Received: by 2002:a02:908a:: with SMTP id x10mr13691450jaf.30.1629396594135; Thu, 19 Aug 2021 11:09:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629396594; cv=none; d=google.com; s=arc-20160816; b=N319TCZWWaOB1iDQ9xVoNPEYQ1uttX5z6EVZdnGst1QljmtsGldIJysO/yNwNlJ/dQ /zvYt7ALRilelNo4jVQYRR32h39nErkglO9Y1z83RuYZsdFrolpyKTVqQQFWv5GpiAIV DjRumUQl+SWUm5Dnsq5Ed/1LckF/dd/LLwMQLcA3qm3imYHHn2ByLevXVSP22FRvuAVR FyOrSrEOZ1u1qEBo40PBGsoLnSE3cx0juWmk+AnmQoMj0FAr85Vi1fvH/N/el+y2GTkN 55njjJekVTG4IIZW3OcybNbMpfAmunDogJY3EWfPTNka7flB7O3solP4ULYQfhkD3FnV RYrw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=nJFsB0vNTcvxAccxAs8X/3nZKeh6jAZ98Q3ZjWO+LEQ=; b=V+xwC1wHekRb3YOXzU+XXiuez1D7r/yycxgx6NK2fb0YUc8TBCxaXnpXIND3t+hiKu BU/qDTWCKvt0voCQZ32MTgmjz7+DePY+gcfzS0m+BjOfsT7MgxakXudhPVstETKrEs8b WiHeqFNXdLDOICoX0QS1PjKFCyUazhuo7v44TrrGWcyd+v+QSHunv8JMcwNdu8yJaJld ftizqoAjtKupfAnL8FQpVxvs6Jlzloy9yivi+jrkA/G+RvSI5Bo4YjIm3r0W/EC2EtBp SDA0j99c4jE0DTxlBaw/ZYW6C4AmD0NDn4HYuCV/XSIbPc+QeSnczUGNIog/4qR0RMw3 +u6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Wv1an5Vd; spf=pass (google.com: domain of linux-usb-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-usb-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h10si3606755ioe.21.2021.08.19.11.09.54; Thu, 19 Aug 2021 11:09:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-usb-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Wv1an5Vd; spf=pass (google.com: domain of linux-usb-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-usb-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234261AbhHSSK3 (ORCPT + 4 others); Thu, 19 Aug 2021 14:10:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39142 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234246AbhHSSK3 (ORCPT ); Thu, 19 Aug 2021 14:10:29 -0400 Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 921C6C061575 for ; Thu, 19 Aug 2021 11:09:52 -0700 (PDT) Received: by mail-wm1-x32c.google.com with SMTP id f13-20020a1c6a0d000000b002e6fd0b0b3fso5754651wmc.3 for ; Thu, 19 Aug 2021 11:09:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=nJFsB0vNTcvxAccxAs8X/3nZKeh6jAZ98Q3ZjWO+LEQ=; b=Wv1an5VdNrbgraw7EX4H4zOhAWUPNg2I0JM/753YIzCbjA5Fx6Kn8wDX9L0cBzoKh7 S5UIdzHCbLSh7anQxjs6GFdS357toSGUTNdnkKtneCQk3+XSV1/gOTSL9IDzzNRR0PRN eLYOj7pHYzFoKVUJKyvy3+rXMHhFItIDPqT+7fnRqg/Xf6gVNVnlqUu6cJd4IK05bUE/ Gna/oPee5FUhDuYAQ2Zv8EejH9bnKsyWIvLJI93DaXnvURx/eWridh/8WuOY7cHNavhO vi1qI0oA9q29RKMTROdLeWNCbmV99y40fpwVTalsMFcDcn7y6QHNiofcQF1dE6NajH8+ +1sg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=nJFsB0vNTcvxAccxAs8X/3nZKeh6jAZ98Q3ZjWO+LEQ=; b=hMApu5e31ie1yHCyUNnJ2UA2j7ogxvylJMr/ly1//D3oaRapxxXAUe4atVQjAPK1E4 JZdNB7oXYJi/okhpSfhnIGlhVFuurKhlVwiCgT1Hpu/s/VMbtv2LMlp7cX5MzjoUzJYh Yu6cHcS3yiFJbHKiO/4F3RX+nSZ6ElcxVgSnon3pTy77KXZM4nafBeV6Qkp6dJwGqoQP csGI3fmKH8VxofZ6oU7R+ndLKu8e/9qhK3cjOOJ6uAa25zCZdDx86UMnl42JMGYUbdr6 wXzVMWUHhVJu6djyvQbDKsRZKd/zHEwxnT4irnBdRDjzhJj5qm+6kTh/LNbUko3Hl2Wo sp5Q== X-Gm-Message-State: AOAM532u47NZ+3LiUo2qMJkdMN/pFYgJnmPk11MKEy+12d8z6fh5cFbE /YzzApqrnMWTBwrCoLoTuzxO9w== X-Received: by 2002:a7b:cf0c:: with SMTP id l12mr25984wmg.62.1629396591112; Thu, 19 Aug 2021 11:09:51 -0700 (PDT) Received: from arch-thunder.local (a109-49-46-234.cpe.netcabo.pt. [109.49.46.234]) by smtp.gmail.com with ESMTPSA id h16sm3625668wre.52.2021.08.19.11.09.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Aug 2021 11:09:50 -0700 (PDT) From: Rui Miguel Silva To: Greg Kroah-Hartman , Alan Stern Cc: linux-usb@vger.kernel.org, Rui Miguel Silva Subject: [PATCH 2/5] usb: isp1760: check maxpacketsize before using it Date: Thu, 19 Aug 2021 19:09:26 +0100 Message-Id: <20210819180929.1327349-3-rui.silva@linaro.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210819180929.1327349-1-rui.silva@linaro.org> References: <20210819180929.1327349-1-rui.silva@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org When checking if we need one more packet on a bulk pipe we may, even though not probable at all, get there with a zero maxpacketsize. In that case for sure no packet, no even a one more, will be allocated. This will clean the clang-analyzer warning: drivers/usb/isp1760/isp1760-hcd.c:1856:38: warning: Division by zero [clang-analyzer-core.DivideZero] && !(urb->transfer_buffer_length % Signed-off-by: Rui Miguel Silva --- drivers/usb/isp1760/isp1760-hcd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.33.0 diff --git a/drivers/usb/isp1760/isp1760-hcd.c b/drivers/usb/isp1760/isp1760-hcd.c index 2a21fe5aa7a8..5c947a1eae49 100644 --- a/drivers/usb/isp1760/isp1760-hcd.c +++ b/drivers/usb/isp1760/isp1760-hcd.c @@ -1854,7 +1854,7 @@ static void packetize_urb(struct usb_hcd *hcd, packet_type = OUT_PID; else packet_type = IN_PID; - } else if (usb_pipebulk(urb->pipe) + } else if (usb_pipebulk(urb->pipe) && maxpacketsize && (urb->transfer_flags & URB_ZERO_PACKET) && !(urb->transfer_buffer_length % maxpacketsize)) {