Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp1408851ybi; Fri, 2 Aug 2019 15:12:58 -0700 (PDT) X-Google-Smtp-Source: APXvYqx+g0fBh8gYbhF/mg/qfWeiXRFoc4mtfgHCDmbHmD2ihTEobhuCEuJujuBbukRTGb8uzEEa X-Received: by 2002:a17:902:9a49:: with SMTP id x9mr134645437plv.282.1564783978420; Fri, 02 Aug 2019 15:12:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564783978; cv=none; d=google.com; s=arc-20160816; b=cGc1q1zGRPHdYHO030SPlv3/Hu3tzkA48LZY+ARu4mMj8czE8Ozzj/9C2CjpMq+78l lXsbg6J/43juIyceZUUs00VpvTqN0VdlE3jQVQDkGph4U1Omn4CoaxREXeAt9RRxfBGW PBmQ0jTRYtlZpjeASxfCl8G8s3hwbV0Pc+qfNt/+2zMoChCKfwf6LCFKrKTDycwB08Do lAKiShNYEEf98iED8tMsqg+27IlhAA0zneM3Opdnts65U57t58VR5jBXL6/+wvEquUL0 WDZs3XVTr8Mi2tJFgiB+2aS0L7epn2/AUkUXs7L+I2XBlvwXNlifhToSHObi10/ph6sw i1gQ== 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-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=D8InByrhcr92ADrmQpnnJ0Sydv0rwzh0DmBC1zcwF5w=; b=WuCXysuPCgjqx87rNfN7DYugJT7IvxNACAALsPn8okOgp6r7MGC+GQ8FHeECMhW80K Sz0+p7Eh0NyTdQCuoSmVxJaZy6ysOxn8+SnsT78iZMY1yLPhj6nenyd2vRlJSHeRXtgv 4yVnHukm5DtzYWVgsWighF/B0PaQ84oy+KwfDXu1rTMN+td5gyxOg4Z8wfDlxih43egv d8UXgYTZqVGl2brIx7cjPjFuKnur2movj47E1xhgG0/vrD/Qbcye+Ntek/XPbxHeOuxk r2UERAZrNIxGtDQSkel9/sdLa+mLNIxqsVZluFvZdUwgfaRxDvSacI2K8JMcRFf8N/R1 Z7/w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e14si31873070pgg.442.2019.08.02.15.12.42; Fri, 02 Aug 2019 15:12:58 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389053AbfHBMMg (ORCPT + 99 others); Fri, 2 Aug 2019 08:12:36 -0400 Received: from metis.ext.pengutronix.de ([85.220.165.71]:46919 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729065AbfHBMMg (ORCPT ); Fri, 2 Aug 2019 08:12:36 -0400 Received: from pty.hi.pengutronix.de ([2001:67c:670:100:1d::c5]) by metis.ext.pengutronix.de with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1htWQC-0007TE-DC; Fri, 02 Aug 2019 14:12:32 +0200 Received: from ukl by pty.hi.pengutronix.de with local (Exim 4.89) (envelope-from ) id 1htWQB-0006ud-Qg; Fri, 02 Aug 2019 14:12:31 +0200 Date: Fri, 2 Aug 2019 14:12:31 +0200 From: Uwe =?iso-8859-1?Q?Kleine-K=F6nig?= To: Schrempf Frieder Cc: "shawnguo@kernel.org" , "s.hauer@pengutronix.de" , "kernel@pengutronix.de" , "festevam@gmail.com" , "linux-imx@nxp.com" , Greg Kroah-Hartman , "geert+renesas@glider.be" , "linux-kernel@vger.kernel.org" , "linux-serial@vger.kernel.org" , Jiri Slaby , "linux-arm-kernel@lists.infradead.org" Subject: Re: [PATCH v3 2/4] serial: mctrl_gpio: Add a NULL check to mctrl_gpio_to_gpiod() Message-ID: <20190802121231.wk6yg5mkyivs3rni@pengutronix.de> References: <20190802100349.8659-1-frieder.schrempf@kontron.de> <20190802100349.8659-2-frieder.schrempf@kontron.de> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20190802100349.8659-2-frieder.schrempf@kontron.de> User-Agent: NeoMutt/20170113 (1.7.2) X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::c5 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Aug 02, 2019 at 10:04:10AM +0000, Schrempf Frieder wrote: > From: Frieder Schrempf > > As it is allowed to use the mctrl_gpio_* functions before > initialization (as the 8250 driver does according to 434be0ae7aa7), Actually I was surprised some time ago that 8250 used serial_mctrl without first initializing it and expecting it to work. I didn't look in detail, but I wouldn't go so far to call this "allowed". The commit itself calls it "workaround" which seems a better match. > it seems appropriate to have a NULL check in all of the functions. > Otherwise the mctrl_gpio_to_gpiod() function is prone to be used > in a context that can lead to a NULL pointer dereference. > > Signed-off-by: Frieder Schrempf Best regards Uwe -- Pengutronix e.K. | Uwe Kleine-K?nig | Industrial Linux Solutions | http://www.pengutronix.de/ |