Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3125851pxk; Tue, 15 Sep 2020 10:39:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxVxrIL81y6uJG9+0XIzIu9lceLLxFktiNpM8VtPx0nFh95/1G7X13vr+k1Eisr/pyM255O X-Received: by 2002:a05:6402:1d29:: with SMTP id dh9mr24282076edb.124.1600191580205; Tue, 15 Sep 2020 10:39:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600191580; cv=none; d=google.com; s=arc-20160816; b=kBiERGgHG7MJ1f9YdALk8AV3kNk2b0KX4IgVHD+CeRerdLdebddNVUne/2O0k0N8Fv h4yqNpfmzSW+oceYee7UuwaB/hr2FMlBc1gD1I40z54hKOAuCL6lu6VOudcWZewjL6HK jErT8xqQI+4ZOO9G9+KHxsBJrPzIsjt9ph0GUQ7/wYGiAJ81pee4ITfornUphZS0FMYQ CFHG6MWKri/64QS35NpIBg1lvWaGv40Nks9fi1aWfGvoYe7iUQmqmqc5bGj7rgr2XhVc CbmEtZ7yIJlD9KygGC/KoQLiVsnGlWkQtQEf+k6aaXuSop7uupzx3c/iAkw/eQ6j9rVP SPyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=PZvavpKZmvFJqEd2kg0leX8Xh/7xwOyj9XGjx4+QgGU=; b=wPP+sdGBRm5vckaJG8a5AUkr057OStqP2gkutFE3Yh+N38yJ+QjySGWJDv2UDtFQNR Zrj0s3fcOiyLgB/tRZIfg2HR23zc7GHAVTqa/fNtVi9lsN8npfGhDRasuimJsJedCEqW WTs9T363mkTnmuekpX9SeqbOmsRCkjAdfR7gY5uGW4IbWjzkVVrgYWqFEA4k3GsiubcL siIlsS5iB/oPSuETmemCz2Hf4HzkjileJkffA0eQu6qeztr4oYukStpUuyZP//QjkB12 8q2eDv7By2kcASaVvUyeljydWPPw014FOLFuFtKB0X+hAQ+/8Za7oc1Eh8rzzbX2c+3S YVxg== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p93si9999986edp.343.2020.09.15.10.39.18; Tue, 15 Sep 2020 10:39:40 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727712AbgIORhk (ORCPT + 99 others); Tue, 15 Sep 2020 13:37:40 -0400 Received: from gofer.mess.org ([88.97.38.141]:53155 "EHLO gofer.mess.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727884AbgIORPm (ORCPT ); Tue, 15 Sep 2020 13:15:42 -0400 Received: by gofer.mess.org (Postfix, from userid 1000) id 7F5D3C6366; Tue, 15 Sep 2020 18:12:56 +0100 (BST) Date: Tue, 15 Sep 2020 18:12:56 +0100 From: Sean Young To: Colin King Cc: Mauro Carvalho Chehab , Maxim Levitsky , linux-media@vger.kernel.org, kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] media: rc: fix check on dev->min_timeout for LIRC_GET_MIN_TIMEOUT ioctl Message-ID: <20200915171256.GA681@gofer.mess.org> References: <20200915153608.35154-1-colin.king@canonical.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200915153608.35154-1-colin.king@canonical.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Sep 15, 2020 at 04:36:08PM +0100, Colin King wrote: > From: Colin Ian King > > Currently the LIRC_GET_MIN_TIMEOUT is checking for a null dev->max_timeout > and then accessing dev->min_timeout, hence we may have a potential null > pointer dereference issue. This looks like a cut-n-paste typo, fix it > by checking on dev->min_timeout before accessing it. max_timeout and min_timeout are both u32, not pointers. So, the commit message is wrong: there is no null pointer dereference issue. Every driver which has max_timeout also has min_timeout set (I've checked for this). So technically this is not wrong, but maybe it looks wrong? Thanks, Sean > > Addresses-Coverity: ("Copy-paste error") > Fixes: e589333f346b ("V4L/DVB: IR: extend interfaces to support more device settings") > Signed-off-by: Colin Ian King > --- > drivers/media/rc/lirc_dev.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/media/rc/lirc_dev.c b/drivers/media/rc/lirc_dev.c > index 220363b9a868..d230c21e1d31 100644 > --- a/drivers/media/rc/lirc_dev.c > +++ b/drivers/media/rc/lirc_dev.c > @@ -533,7 +533,7 @@ static long lirc_ioctl(struct file *file, unsigned int cmd, unsigned long arg) > > /* Generic timeout support */ > case LIRC_GET_MIN_TIMEOUT: > - if (!dev->max_timeout) > + if (!dev->min_timeout) > ret = -ENOTTY; > else > val = dev->min_timeout; > -- > 2.27.0