Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp1072285imm; Tue, 3 Jul 2018 05:09:01 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeBZFrVwUj3RMlBkqk+yob2/1FC+R3LpobaUx6nA/smbqLLdCaGGogAH4Tj4pUuINaSPv22 X-Received: by 2002:a62:b94:: with SMTP id 20-v6mr28853671pfl.234.1530619741511; Tue, 03 Jul 2018 05:09:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530619741; cv=none; d=google.com; s=arc-20160816; b=wsK4rKmkW73Y/hnj/lwIYk2skb1cuUhm377hRxGkDl/pBsdTe+4RcxKVjmnh7tadzO SzWWPOENTLQwGQLciEikrA0e5vT0lbp5QgvklZ8pH3HrmDs/YiV6BvURsmDwT/GWo6a4 gs9RS5ogyNlr/IHG5bsSKUT40kqS8ovRThZD45gv4h5POGfXv23nOuq6JfA2VeHNcT8q r38mXRKFN5eWkoDm89xn8Tfwng6yeY6mjYkb/eI0Ahna2bIiggPecg+msDhajd8gFiEQ nU8nudvZExzsacAcZ8ywsNtoR4gf3hFwlJ4J+7KZaPamiqlNrLp/dLk95n7N9lIXQxXx VA8Q== 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 :arc-authentication-results; bh=DHZHPl+Flxzdn5h3HGD3iDrUgdBkCiqlsFFOBU5oAso=; b=aE3SN7XpVtLjoDnN28Xk25iRDWtx4lb3acKdvopzO8/Pe+NsiyPZMlST7zDODhzIjU tn7qyGPbd9snumRHlxTNcCNmSn3QQ31jqItZ/YY6dasjegtN7tvjDRCAzZ0TOLLI/Kbo 922phFmSXEVJLnGeywV0cICOHjY9GoHSGGJawqbSKU73eADvOEA2egqjBtqmnUJ3hvy2 N97lCsvXr7Ev/VJrpul8qzA0vr7exrsp6dGgiTHZIB/ZG24Gl+ZEqeGRthr+Ko1vvZin hAXqIfhJdpLGv6QeEUUdbIq3tEdcUqW40jkmJjzkKfmblRrKoC/BREOWUrNjkz0ytHkk HaIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=uF92bh4J; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i61-v6si1019659plb.138.2018.07.03.05.08.22; Tue, 03 Jul 2018 05:09:01 -0700 (PDT) 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=@gmail.com header.s=20161025 header.b=uF92bh4J; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753249AbeGCMHY (ORCPT + 99 others); Tue, 3 Jul 2018 08:07:24 -0400 Received: from mail-pf0-f178.google.com ([209.85.192.178]:46727 "EHLO mail-pf0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752381AbeGCMHX (ORCPT ); Tue, 3 Jul 2018 08:07:23 -0400 Received: by mail-pf0-f178.google.com with SMTP id l123-v6so920493pfl.13; Tue, 03 Jul 2018 05:07:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=DHZHPl+Flxzdn5h3HGD3iDrUgdBkCiqlsFFOBU5oAso=; b=uF92bh4JMrm9STN7qAzW73HgtNuckVqBHtEwNfhTP2IOCbEddFHh7g12MkDUtfhi+b 2C0bilcsDcyp4WEkCdfB2DJtT3ICYglnZYYPv3fviUJEcRCcGXoVvXQfi7WPvQQ+C6Sd Nmm54exZ0lONfAdFIX5KlM74YZLE0DAyJxyugwXKJdKl99x9Rpuvuj2sFqltKrAOqpaS So2QhCV0pF14v7jE4ED/7PtRqvcZUg39TEfxMpe+VTNwVGgQtxUmJmUE1wsxw0mt1/Oj 8O1ysFZxbo5imsdnlHyRiDrMEq5KQAdPwvnUToNj4hdy1pP/IqC+MW3INekfqbXlJBpD Zpkw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=DHZHPl+Flxzdn5h3HGD3iDrUgdBkCiqlsFFOBU5oAso=; b=l+QQW8PU/PGQ1exhLPpSg2fbPfWuJ1hZ9tZJJhfqaKGMqsn/fIuV2JY+zdkaPiqYDo xiAqpeP89iIWEOQzLMe+sXfYCJokWEILF5AhFT5CURocFQs5mbohGjadTkYTAI4LvObU 6y8HZYcp+00zdEeluhrnG6Ye7+fJoL1m8d33lUQMopXBOGxM0JXjGOQL3WqcZ8GlSSiF 19cgDMl1d7p/aDLHhu8AK84VJP5ZzQf2X1+dnB4hsSNev9lG8c78EX741I4lOtMzD+G4 6T83PfOy/DjIj1IqxxYxss7qP5DuiEpt6znjKcRu3R/HLFyAR+3fOWo6A85tbSQW3T7l aIJQ== X-Gm-Message-State: APt69E14bvJF6eFAavklaykTD4fu3RzmlOx3rMuZZqx0ga2i3/XRa6A2 XIOXr1c9KCHxqskHuvr9iTDPYg== X-Received: by 2002:a62:9d14:: with SMTP id i20-v6mr2160736pfd.3.1530619641460; Tue, 03 Jul 2018 05:07:21 -0700 (PDT) Received: from [192.168.3.4] (softbank219203027033.bbtec.net. [219.203.27.33]) by smtp.gmail.com with ESMTPSA id d65-v6sm2503234pfj.20.2018.07.03.05.07.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 03 Jul 2018 05:07:20 -0700 (PDT) Subject: Re: media: dvb-usb-v2/gl861: ensure USB message buffers DMA'able To: Colin Ian King , Mauro Carvalho Chehab , linux-media@vger.kernel.org, Antti Palosaari Cc: "linux-kernel@vger.kernel.org" References: <8308d9f0-2257-101c-69e3-8fe165de9348@canonical.com> From: Akihiro TSUKADA Message-ID: Date: Tue, 3 Jul 2018 21:07:07 +0900 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <8308d9f0-2257-101c-69e3-8fe165de9348@canonical.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, thanks for the report. > 47 buf = NULL; > > Condition rlen > 0, taking false branch. > > 48 if (rlen > 0) { > 49 buf = kmalloc(rlen, GFP_KERNEL); > 50 if (!buf) > 51 return -ENOMEM; > 52 } > > 53 usleep_range(1000, 2000); /* avoid I2C errors */ > 54 > CID 1470241 (#1 of 1): Explicit null dereferenced (FORWARD_NULL). > var_deref_model: Passing null pointer buf to usb_control_msg, which > dereferences it. > > 55 ret = usb_control_msg(d->udev, usb_rcvctrlpipe(d->udev, 0), > req, type, > 56 value, index, buf, rlen, 2000); > > > The assignment of buf = NULL means a null buffer is passed down the usb > control message stack until it eventually gets dereferenced. This only > occurs when rlen <= 0. I was unsure how to fix this for the case when > rlen <= 0, so I am flagging this up as an issue that needs fixing. > Since rlen is an u16, null pointer is passed only when rlen == 0, so I think it is not a problem, but I am OK to add a guard in order to make scan result clean. regards, Akihiro