Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3134608pxk; Tue, 15 Sep 2020 10:53:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyw+V+pg88mvakIDR/qXMl96C+ZSGlQKsN4Cpb1kc/7ZQ7nj/nbgRnqRuExhCDewYHFwDyS X-Received: by 2002:a17:906:1c13:: with SMTP id k19mr13879863ejg.384.1600192425423; Tue, 15 Sep 2020 10:53:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600192425; cv=none; d=google.com; s=arc-20160816; b=NcuoB9ZNZ7uIzlvitjN70wqJI7SHHEcG6kOwxe9q2ftZoSbmDRba37p6GX5jOlmkBc okm4BDATrAFJdyMO1U43aBoMEb/uuwjSAyg9oWcnGcfA21SaafAXAj9Fa8qJDA0iN0pu fiPSOtSyif/kMVPdzjcNlZlBOwn8x6BEZ6EMxvL9yiVFyD7FPgVNroYBFkZhGlaLO0Ti wN/69O3JrsXdnU/BUERjHewjSurH1m5Q/6gu95U1kOmAfXzqQ3lQ+yoivzjYL2ss8bAO BxKgl3RvAU0f5fhe3y2hBwR9zkMK/7NTDHBnyGFB0cBWthUZS+I3kQK1Foim+iSj6FMM x99w== 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; bh=qDdOCs584pwvNk2l9M/TsjbiHhlwpIqjqd/RJORvmbs=; b=cxM26oJ8/eGs7WCeFmLDx4kzOgxtgAQXur2B/r30iQouEVrbf0JlN9Hml2JpzfK+S/ A0hPAMIOcGwvHfjKcrEmRXSgbLQgLQYJ8jtIeSGmkOwlkgXRymPcTNswlmeT0aZMPi1d VARKJs49jZOt5b+CUUaWTavqQigl07jg0pq2PGdqRPSn1+V4xSJMutx/XEtOyeTyv4gR iRTtbCAtMPWIe47sIUX2JvJ+uN5v70khF7lJdtWolkOJ0VJemeA9ocMl5GjDnNKEMb1f TWKZIuf5REwn0rOA8sMQUGlpLdG5g5Yh8wlPqcuMSFNZCNo7MkkMtK8a6wlScLB9+pO1 RCmA== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id pj10si9992434ejb.398.2020.09.15.10.53.23; Tue, 15 Sep 2020 10:53:45 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727965AbgIORwW (ORCPT + 99 others); Tue, 15 Sep 2020 13:52:22 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:51518 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727872AbgIORdL (ORCPT ); Tue, 15 Sep 2020 13:33:11 -0400 Received: from 1.general.cking.uk.vpn ([10.172.193.212]) by youngberry.canonical.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1kIEXS-00033S-SU; Tue, 15 Sep 2020 17:14:42 +0000 Subject: Re: [PATCH] media: rc: fix check on dev->min_timeout for LIRC_GET_MIN_TIMEOUT ioctl To: Sean Young Cc: Mauro Carvalho Chehab , Maxim Levitsky , linux-media@vger.kernel.org, kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org References: <20200915153608.35154-1-colin.king@canonical.com> <20200915171256.GA681@gofer.mess.org> From: Colin Ian King Message-ID: Date: Tue, 15 Sep 2020 18:14:42 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.2.1 MIME-Version: 1.0 In-Reply-To: <20200915171256.GA681@gofer.mess.org> 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 On 15/09/2020 18:12, Sean Young wrote: > 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? Oops. I totally misread the analysis report. My bad. > > 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