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=-9.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham 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 96F8AC43463 for ; Fri, 18 Sep 2020 16:29:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5096321D42 for ; Fri, 18 Sep 2020 16:29:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726376AbgIRQ3J (ORCPT ); Fri, 18 Sep 2020 12:29:09 -0400 Received: from honk.sigxcpu.org ([24.134.29.49]:34772 "EHLO honk.sigxcpu.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725955AbgIRQ3I (ORCPT ); Fri, 18 Sep 2020 12:29:08 -0400 X-Greylist: delayed 375 seconds by postgrey-1.27 at vger.kernel.org; Fri, 18 Sep 2020 12:29:07 EDT Received: from localhost (localhost [127.0.0.1]) by honk.sigxcpu.org (Postfix) with ESMTP id DB0ADFB03; Fri, 18 Sep 2020 18:22:50 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at honk.sigxcpu.org Received: from honk.sigxcpu.org ([127.0.0.1]) by localhost (honk.sigxcpu.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id WCYvx8P8Moua; Fri, 18 Sep 2020 18:22:49 +0200 (CEST) Received: by bogon.sigxcpu.org (Postfix, from userid 1000) id 3E70C457CC; Fri, 18 Sep 2020 18:22:49 +0200 (CEST) Date: Fri, 18 Sep 2020 18:22:49 +0200 From: Guido =?iso-8859-1?Q?G=FCnther?= To: Colin King Cc: Purism Kernel Team , Thierry Reding , Sam Ravnborg , David Airlie , Daniel Vetter , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: Re: [PATCH][next] drm/panel: fix null pointer dereference on pointer mode Message-ID: <20200918162249.GA292461@bogon.m.sigxcpu.org> References: <20200918155136.28958-1-colin.king@canonical.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200918155136.28958-1-colin.king@canonical.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On Fri, Sep 18, 2020 at 04:51:36PM +0100, Colin King wrote: > From: Colin Ian King > > Currently a null pointer check on pointer mode is passing mode to > function drm_mode_vrefresh and this causes a null pointer dereference > on mode. Fix this by not calling drm_mode_vrefresh since the call > is only required for error reporting. > > Addresses-Coverity: ("Dereference after null check") > Fixes: 72967d5616d3 ("drm/panel: Add panel driver for the Mantix MLAF057WE51-X DSI panel") > Signed-off-by: Colin Ian King > --- > drivers/gpu/drm/panel/panel-mantix-mlaf057we51.c | 5 ++--- > 1 file changed, 2 insertions(+), 3 deletions(-) > > diff --git a/drivers/gpu/drm/panel/panel-mantix-mlaf057we51.c b/drivers/gpu/drm/panel/panel-mantix-mlaf057we51.c > index 3482e28e30fc..be4761a643f9 100644 > --- a/drivers/gpu/drm/panel/panel-mantix-mlaf057we51.c > +++ b/drivers/gpu/drm/panel/panel-mantix-mlaf057we51.c > @@ -202,9 +202,8 @@ static int mantix_get_modes(struct drm_panel *panel, > > mode = drm_mode_duplicate(connector->dev, &default_mode); > if (!mode) { > - dev_err(ctx->dev, "Failed to add mode %ux%u@%u\n", > - default_mode.hdisplay, default_mode.vdisplay, > - drm_mode_vrefresh(mode)); > + dev_err(ctx->dev, "Failed to add mode %ux%u\n", > + default_mode.hdisplay, default_mode.vdisplay); > return -ENOMEM; > } drm_mode_vrefresh(&default_mode) gives some more clue what's going on - I have had a fix queued up in my tree already but if you send a v2 that's fine. Thanks! -- Guido > > -- > 2.27.0 >