Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3330028imu; Sun, 11 Nov 2018 12:31:01 -0800 (PST) X-Google-Smtp-Source: AJdET5dbci20B9Tp0JNSOjzFaWUPMah2ISkgYRzp+7/NjcnmmtoLddzdAI1x1HEGNfPdT9kDBrZx X-Received: by 2002:a17:902:544:: with SMTP id 62-v6mr16523690plf.73.1541968261478; Sun, 11 Nov 2018 12:31:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541968261; cv=none; d=google.com; s=arc-20160816; b=ioAtiDiO+jI4a7PmpeV0wewru8U+CRTio0N/mDnf0ML7EQ7P7xe3mfXawjthwFO1kM V8aYkHqXpqOLDWkNlcFE0qB2phIRyxpBSkJPQ8wHBqi1HwVDmbbCID2/HAStRPQu8NJS nVaOppPSiS5lQ5G74upF3KCxEDvgeNvunhv2o1YyhRiLiuV7N8SalbbzkLrM0d57xKCg +lojK/m5dNWA2z1BAQ12j7KbDx59tX7f2D2w9mQIyC9gd/O4NOTiWLMz38EpV5Hom0Af qY648eTstm7ZibjjeEEDfqq+2BJ/Atw6Rx0hJ/qqspbW1IvEiyXJ9/hGMIb8UTkZdgmD Q7WA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:subject:message-id:date:cc:to :from:mime-version:content-transfer-encoding:content-disposition; bh=jIzjac5U8CmDY9sTywjC+IF9sTC1s0ScpcqNeJwKgDo=; b=gCQGB7NexWgUyi3N8I5o9TgMX9ru45DbpTR5hdLCcC3yHIrnZRd2vvoqgf5JM+nh4v 09ePSNx5nohYQCfKvhSGSI6DkjgcpqblSNnc681+Nn40La4+9DRwRoKFh7omP0r9VJuG VyGkBtygRy/dc/Jyax1dmeAEo1tsS3P6IFz92J+gn5rfJV4jdqfVrp+GrgRaS9VNjh8M fCngPBkA3jMehDms3jPFw1d4/LC81apiYY9bjAXZHDrdI3cY8Ol/quSGBRK/sApIsOjF gRUeipzG/kgvlGfZUNctfskHSiwGXSRV9zDllBNb3NuRHp54DKH3mIVFI5VAJwVR7OfO RxIQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o10-v6si15004219pls.402.2018.11.11.12.30.46; Sun, 11 Nov 2018 12:31:01 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730703AbeKLGSP (ORCPT + 99 others); Mon, 12 Nov 2018 01:18:15 -0500 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:50598 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730489AbeKLFsX (ORCPT ); Mon, 12 Nov 2018 00:48:23 -0500 Received: from [192.168.4.242] (helo=deadeye) by shadbolt.decadent.org.uk with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1gLvsi-0000oO-Cg; Sun, 11 Nov 2018 19:58:52 +0000 Received: from ben by deadeye with local (Exim 4.91) (envelope-from ) id 1gLvsa-0001r3-2I; Sun, 11 Nov 2018 19:58:44 +0000 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, "Shuah Khan" , "Greg Kroah-Hartman" , "Dan Carpenter" Date: Sun, 11 Nov 2018 19:49:05 +0000 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) Subject: [PATCH 3.16 335/366] usbip: stub_rx: fix static checker warning on unnecessary checks In-Reply-To: X-SA-Exim-Connect-IP: 192.168.4.242 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.16.61-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: Shuah Khan commit 10c90120930628e8b959bf58d4a0aaef3ae5d945 upstream. Fix the following static checker warnings: The patch c6688ef9f297: "usbip: fix stub_rx: harden CMD_SUBMIT path to handle malicious input" from Dec 7, 2017, leads to the following static checker warning: drivers/usb/usbip/stub_rx.c:346 get_pipe() warn: impossible condition '(pdu->u.cmd_submit.transfer_buffer_length > ((~0 >> 1))) => (s32min-s32max > s32max)' drivers/usb/usbip/stub_rx.c:486 stub_recv_cmd_submit() warn: always true condition '(pdu->u.cmd_submit.transfer_buffer_length <= ((~0 >> 1))) => (s32min-s32max <= s32max)' Reported-by: Dan Carpenter Signed-off-by: Shuah Khan Signed-off-by: Greg Kroah-Hartman Signed-off-by: Ben Hutchings --- drivers/staging/usbip/stub_rx.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) --- a/drivers/staging/usbip/stub_rx.c +++ b/drivers/staging/usbip/stub_rx.c @@ -353,14 +353,6 @@ static int get_pipe(struct stub_device * epd = &ep->desc; - /* validate transfer_buffer_length */ - if (pdu->u.cmd_submit.transfer_buffer_length > INT_MAX) { - dev_err(&sdev->udev->dev, - "CMD_SUBMIT: -EMSGSIZE transfer_buffer_length %d\n", - pdu->u.cmd_submit.transfer_buffer_length); - return -1; - } - if (usb_endpoint_xfer_control(epd)) { if (dir == USBIP_DIR_OUT) return usb_sndctrlpipe(udev, epnum); @@ -494,8 +486,7 @@ static void stub_recv_cmd_submit(struct } /* allocate urb transfer buffer, if needed */ - if (pdu->u.cmd_submit.transfer_buffer_length > 0 && - pdu->u.cmd_submit.transfer_buffer_length <= INT_MAX) { + if (pdu->u.cmd_submit.transfer_buffer_length > 0) { priv->urb->transfer_buffer = kzalloc(pdu->u.cmd_submit.transfer_buffer_length, GFP_KERNEL);