From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751470AbdKUIYA (ORCPT ); Tue, 21 Nov 2017 03:24:00 -0500 Received: from mx07-00178001.pphosted.com ([62.209.51.94]:7936 "EHLO mx07-00178001.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751226AbdKUIX6 (ORCPT ); Tue, 21 Nov 2017 03:23:58 -0500 From: Patrice CHOTARD To: "Gustavo A. R. Silva" , Mauro Carvalho Chehab CC: "linux-arm-kernel@lists.infradead.org" , "linux-media@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH] c8sectpfe: fix potential NULL pointer dereference in c8sectpfe_timer_interrupt Thread-Topic: [PATCH] c8sectpfe: fix potential NULL pointer dereference in c8sectpfe_timer_interrupt Thread-Index: AQHTYggAkQh5swCcf0y4ra9cyhf/y6MebvIA Date: Tue, 21 Nov 2017 08:22:39 +0000 Message-ID: References: <20171120140055.GA728@embeddedor.com> In-Reply-To: <20171120140055.GA728@embeddedor.com> Accept-Language: fr-FR, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: user-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 x-ms-exchange-messagesentrepresentingtype: 1 x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.75.127.47] Content-Type: text/plain; charset="utf-8" Content-ID: MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-11-21_03:,, signatures=0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by nfs id vAL8O4uQ029789 Hi Gustavo On 11/20/2017 03:00 PM, Gustavo A. R. Silva wrote: > _channel_ is being dereferenced before it is null checked, hence there is a > potential null pointer dereference. Fix this by moving the pointer dereference > after _channel_ has been null checked. > > This issue was detected with the help of Coccinelle. > > Fixes: c5f5d0f99794 ("[media] c8sectpfe: STiH407/10 Linux DVB demux support") > Signed-off-by: Gustavo A. R. Silva > --- > drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c b/drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c > index 59280ac..23d0ced 100644 > --- a/drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c > +++ b/drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c > @@ -83,7 +83,7 @@ static void c8sectpfe_timer_interrupt(unsigned long ac8sectpfei) > static void channel_swdemux_tsklet(unsigned long data) > { > struct channel_info *channel = (struct channel_info *)data; > - struct c8sectpfei *fei = channel->fei; > + struct c8sectpfei *fei; > unsigned long wp, rp; > int pos, num_packets, n, size; > u8 *buf; > @@ -91,6 +91,8 @@ static void channel_swdemux_tsklet(unsigned long data) > if (unlikely(!channel || !channel->irec)) > return; > > + fei = channel->fei; > + > wp = readl(channel->irec + DMA_PRDS_BUSWP_TP(0)); > rp = readl(channel->irec + DMA_PRDS_BUSRP_TP(0)); > > Acked-by: Patrice Chotard Thanks