From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4CF19C433E2 for ; Tue, 15 Sep 2020 18:39:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id F3D6520732 for ; Tue, 15 Sep 2020 18:39:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727950AbgIORim (ORCPT ); Tue, 15 Sep 2020 13:38:42 -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