Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp308829ybc; Tue, 12 Nov 2019 01:43:23 -0800 (PST) X-Google-Smtp-Source: APXvYqxRj0pwYVwcprPFFm00Fixv7PM/smC8GVAf3Rm0ycu0XrtR69+u2RVFKmSorNalGBvtb3nr X-Received: by 2002:a17:906:3ec2:: with SMTP id d2mr27735834ejj.251.1573551802910; Tue, 12 Nov 2019 01:43:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573551802; cv=none; d=google.com; s=arc-20160816; b=w0Zzav2FDzXxXo3fbSvL1LM33O8/LStHdvE8OrSyFhy/SFWrZvsogOVMbcG/01gStr qUny+urnxPyd039xgmcnCOSprsLHK7X6PO2m/WkXk3YjPGTGC7rEY4lEZuN/dkWIrl3A Ln5nTKWf/382HGndynG4n4x8CEEWze0tY9aM6fSSaibuL3nqys7iUVGRJnjKiSXkC/Cs yJk1hCnIOHhMwGaB/35aFvLKUrqugxKGTW+aW7d3raDyjM47+17jpLInFi596LlaypkP PgtZg26mNRNy0TEXQBTb//E5jt9G6SdZGm4hbFw3p8Xl540ne69qs8tELsw4aQZjwNWQ 3+Rg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=agKraZDXlh9OuCGHMoP8zxTkq13cDiFM2MkWyZmFJh0=; b=NSMa9pj9cCqj0c/KptieyxfeQRP3TH0utgsAbRQ6vzZ4NQKwu+nuyKDS5vl+XJPlTg LyB8T7muRyWmoUYU5siyHOnjTbuh6NX+pE/HEenzYBe01p+C+BmzY732H0cQvcam+f0L HjFYgtg65wTbe0tvYWVbzzpRhoMrWph/1svZOo4btrd0AyK9U/MSDu98pRuCftFdCOkx V/UOlrsY/g08Dp1oUYl8CKY5dXWXl79VO+HilNFQa4jzxmFBoy06zbsW4nWcyELIR5vJ qr48tgOFc0ndA9yKx8oE5Sz1EeVeNlLwQzrk2NP5SPCYui/yy00sGbKa7yRL8S5JonMH SzxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=BkEifLj7; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ks15si11245941ejb.133.2019.11.12.01.42.58; Tue, 12 Nov 2019 01:43:22 -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; dkim=pass header.i=@kernel.org header.s=default header.b=BkEifLj7; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727439AbfKLJli (ORCPT + 99 others); Tue, 12 Nov 2019 04:41:38 -0500 Received: from mail.kernel.org ([198.145.29.99]:48196 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727399AbfKLJle (ORCPT ); Tue, 12 Nov 2019 04:41:34 -0500 Received: from [192.168.1.9] (unknown [59.97.49.92]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 080F320650; Tue, 12 Nov 2019 09:41:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1573551693; bh=LXxeytabQjsph84q3+95D2mwzsIe1w47bZe2Y4jsDXA=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=BkEifLj71wCGeAGa+cBfeJVnzullgFBNby/EuLvSp5GBhv2h8Mo3cyw1gvBkXcWT0 A6biDw0Qo8IWVv2w1OzqF7s15n1Rv8+Pciaze9ZSjDrtTxSN5YujjZ2rcJ7jDIwTjo zg2oipa6wt+MWMkqYWh3L9iXdYJ6SF0KzspoGJdc= Subject: Re: [PATCH] usbip: Fix uninitialized symbol 'nents' in stub_recv_cmd_submit() To: Suwan Kim , gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, dan.carpenter@oracle.com, valentina.manea.m@gmail.com, kbuild test robot , shuah References: <20191111141035.27788-1-suwan.kim027@gmail.com> From: shuah Message-ID: <270931e3-c859-a0fd-67f5-35d83ef6e5e9@kernel.org> Date: Tue, 12 Nov 2019 02:41:08 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: <20191111141035.27788-1-suwan.kim027@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/11/19 7:10 AM, Suwan Kim wrote: > Smatch reported that nents is not initialized and used in > stub_recv_cmd_submit(). nents is currently initialized by sgl_alloc() > and used to allocate multiple URBs when host controller doesn't > support scatter-gather DMA. The use of uninitialized nents means that > buf_len is zero and use_sg is true. But buffer length should not be > zero when an URB uses scatter-gather DMA. > > To prevent this situation, add the conditional that checks buf_len > and use_sg. And move the use of nents right after the sgl_alloc() to > avoid the use of uninitialized nents. > > If the error occurs, it adds SDEV_EVENT_ERROR_MALLOC and stub_priv > will be released by stub event handler and connection will be shut > down. > > Fixes: ea44d190764b ("usbip: Implement SG support to vhci-hcd and stub driver") > Reported-by: kbuild test robot > Reported-by: Dan Carpenter > Signed-off-by: Suwan Kim > --- Looks good. Acked-by: Shuah Khan thanks, -- Shuah