From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934496AbdDSNei (ORCPT ); Wed, 19 Apr 2017 09:34:38 -0400 Received: from aserp1040.oracle.com ([141.146.126.69]:39438 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934184AbdDSNeg (ORCPT ); Wed, 19 Apr 2017 09:34:36 -0400 Date: Wed, 19 Apr 2017 16:32:49 +0300 From: Dan Carpenter To: Colin King Cc: Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , Vinod Koul , Jeeja KP , Jayachandran B , "Subhransu S . Prusty" , Dharageswari R , Pardha Saradhi K , Yong Zhi , alsa-devel@alsa-project.org, kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] ASoC: Intel: Skylake: fix dereference before NULL check on ebus Message-ID: <20170419133249.ac3sdmn7kqjbxaii@mwanda> References: <20170419121613.12353-1-colin.king@canonical.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170419121613.12353-1-colin.king@canonical.com> User-Agent: NeoMutt/20170113 (1.7.2) X-Source-IP: userv0022.oracle.com [156.151.31.74] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Apr 19, 2017 at 01:16:13PM +0100, Colin King wrote: > From: Colin Ian King > > ebus is being NULL checked however it is being dereferenced > earlier on the assignment bus = ebus_to_hbus(ebus). Fix this > by moving the assignment to after the NULL check on ebus to > avoid a NULL pointer dereference error. > ebus_to_hbus() doesn't dereference "ebus" it just uses it for pointer math. #define ebus_to_hbus(ebus) (&(ebus)->bus) If you pass a NULL to there, it returns an offset starting from NULL but it doesn't Oops. regards, dan carpenter