Received: by 2002:a05:7412:da14:b0:e2:908c:2ebd with SMTP id fe20csp1769934rdb; Mon, 9 Oct 2023 02:13:38 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHrWB2V7fVBfoqV42ZNPgO+m5AYtUPRgOG2yToQhr/stmlFCH4IrS/cQDJ4I3NbaJFcGYx9 X-Received: by 2002:a17:902:d50f:b0:1c3:bc2a:f6b4 with SMTP id b15-20020a170902d50f00b001c3bc2af6b4mr14834944plg.42.1696842817921; Mon, 09 Oct 2023 02:13:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696842817; cv=none; d=google.com; s=arc-20160816; b=ddgxBXqauhMFhe3D7227GTizVFYe5ia/dydgPIrNMVvJE2blAXyQZKrbpccZ6E66Vt x9AAPEOBRL9qAQzQut1147i94JxOgrKV+3cwlfL4/sBrY81FJ0RY9sUlwbuqOnz7tLVO J1dLuU9wfXBIPFPUPF3nmaDtfPQD3VS3YufulaCX0JpMiWJjMf0takeNnZ2QmM3fhSpN ktKTIQpC6uE6jfwJzXYixnrSkUbUCqBGBgRUzEBsmNjQ2070JBwwuGxR4IifRB8P2OH0 chCFFwJ4ehZCAL2L/A56Byc9nBvWQ9PNUjEbe51Ij53WsJhLn32B7NufLXXeB2qvbwkC 0JEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :organization:autocrypt:references:cc:to:content-language:subject :reply-to:from:user-agent:mime-version:date:message-id :dkim-signature; bh=riy2ohNnJTI8tyOBkVxN9+KyXQ2yc80mwJGtwl0WMgc=; fh=TY6vgSyWffaUSQAFhJ0irJEiCZJ9myayAW8zSPgtqBU=; b=SXj5w7C2Dq62HJu7+FHZVocrevQECARl7VpQ0XEVfOj1VJe3KkH/c9pfl91umhkvXO VaCIZvE7jmGsnfh9eb98pfPC93XihREMy6mJm8/YkPuwJbtL30NJNmazh0IomfzYdcoa yPR8oO0Ll8dABVkjQYJFyQSZCD2bwVHCsD7zBxor6DKzEJJHgMLh97VMqS0wp+Ko+qsY THI7Qpdhtow3ewV7RJAn3v4PB7zsyZbT3pBcbL7DvfsBJ0mGQ4G+W/cUzqJ58iC8Ym/v jZ9ZSh/kSKoZCLo0qv4Z+jdU1vC89tDxM4bafvN+FTqS9JaBuqY+b/S7x6CUgapf9WG+ puJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ckI2uJTL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id kx14-20020a170902f94e00b001c88fc3c593si6645325plb.560.2023.10.09.02.13.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Oct 2023 02:13:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ckI2uJTL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 19D9B80A2828; Mon, 9 Oct 2023 02:13:35 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345631AbjJIJNO (ORCPT + 99 others); Mon, 9 Oct 2023 05:13:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51360 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345657AbjJIJNM (ORCPT ); Mon, 9 Oct 2023 05:13:12 -0400 Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EF2A4B6 for ; Mon, 9 Oct 2023 02:13:09 -0700 (PDT) Received: by mail-wr1-x436.google.com with SMTP id ffacd0b85a97d-32487efc319so4088665f8f.1 for ; Mon, 09 Oct 2023 02:13:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1696842788; x=1697447588; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:organization:autocrypt :references:cc:to:content-language:subject:reply-to:from:user-agent :mime-version:date:message-id:from:to:cc:subject:date:message-id :reply-to; bh=riy2ohNnJTI8tyOBkVxN9+KyXQ2yc80mwJGtwl0WMgc=; b=ckI2uJTLQhGZNVBJdnLWclwcNcBtYhEilwWZhTK7Lbtsr4GvIcTSq6+borBYbbdJCz IN80eqYlf7KXBPtzdHIxWRPhCpMMMn3v7O36Mp0hCyTIsn1EmloVAdcv4SvRCAmygvw1 WzUvN+TmLN7KSd4BQaRU0x56jrgAC9iUAFlLfOwlUO0XwjTLQ3J1ox1wUXtO51KoeE07 +CnUegihTcLzdCwD3ySTq+G5zbm3f8VX4H2L93QNMTu+a16wwk8/LS0qSJ0PCFC4d8en jAAPk0blJV/ILf1eXh+/HdxxPzChTz3dEcTKvcbxOVTO70LjEM3eIUi4mSJv9po71ml5 NpRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696842788; x=1697447588; h=content-transfer-encoding:in-reply-to:organization:autocrypt :references:cc:to:content-language:subject:reply-to:from:user-agent :mime-version:date:message-id:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to; bh=riy2ohNnJTI8tyOBkVxN9+KyXQ2yc80mwJGtwl0WMgc=; b=Rw1mHMnqMu7J5ZHky+heskI6uP/y3FD9/YvyvWZtvmMXy1+J1UGfIXmRaIHyRWikn2 tEq7hEaPWO6UkPIS8lVN4LEIFQa7ENVs1hdefYqXGrgRfEBnkwyZNeLZwxnb6P8pN2CI FmP2b7/0oEt3HK7NssNYq985jPiuv7Rye1jO9k5GEJzKzp1toMPGqiNdMmnjjr7dIGXk vMrknSpBweSJhPGv/xwvay8NAif9wAuKTZaRH7W2Pz9I+KW0Uw+i5zqiw/bbCPKHBvLA FDwULzTh2oB9li/QYGMIZ48OBjUNAGxVY3bfdjKwtKGKK95cxKsju2SHMBXzOtsCiY+t MwLw== X-Gm-Message-State: AOJu0Yy+Uj+z4onD3OvArOB0ogBblDW17MJhutfFbSwp29giKVxHTnI9 UMnqfkKRNnH09mpRVq6UTiTaqw== X-Received: by 2002:adf:fdd0:0:b0:324:8353:716f with SMTP id i16-20020adffdd0000000b003248353716fmr12227404wrs.20.1696842788387; Mon, 09 Oct 2023 02:13:08 -0700 (PDT) Received: from [192.168.27.65] (home.beaume.starnux.net. [82.66.176.246]) by smtp.gmail.com with ESMTPSA id e18-20020adffd12000000b0031980783d78sm9021939wrr.54.2023.10.09.02.13.07 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 09 Oct 2023 02:13:08 -0700 (PDT) Message-ID: Date: Mon, 9 Oct 2023 11:13:08 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird From: neil.armstrong@linaro.org Reply-To: neil.armstrong@linaro.org Subject: Re: [PATCH v2] drm/panel/panel-tpo-tpg110: fix a possible null pointer dereference Content-Language: en-US, fr To: Ma Ke , linus.walleij@linaro.org, sam@ravnborg.org, airlied@gmail.com, daniel@ffwll.ch Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org References: <20231009090446.4043798-1-make_ruc2021@163.com> Autocrypt: addr=neil.armstrong@linaro.org; keydata= xsBNBE1ZBs8BCA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9lNBXBKIlewIyVlkOaYvJWSV+p5gdJXOvScNN1epm5YHmf9aE2ZjnqZGoM Mtsyw18YoX9BqMFInxqYQQ3j/HpVgTSvmo5ea5qQDDUaCsaTf8UeDcwYOtgI8iL4oHcsGtUX oUk33HEAEQEAAcLAXwQYAQIACQUCTVkGzwIbDAAKCRAWmrexpM/4rrXiB/sGbkQ6itMrAIfn M7IbRuiSZS1unlySUVYu3SD6YBYnNi3G5EpbwfBNuT3H8//rVvtOFK4OD8cRYkxXRQmTvqa3 3eDIHu/zr1HMKErm+2SD6PO9umRef8V82o2oaCLvf4WeIssFjwB0b6a12opuRP7yo3E3gTCS KmbUuLv1CtxKQF+fUV1cVaTPMyT25Od+RC1K+iOR0F54oUJvJeq7fUzbn/KdlhA8XPGzwGRy 4zcsPWvwnXgfe5tk680fEKZVwOZKIEuJC3v+/yZpQzDvGYJvbyix0lHnrCzq43WefRHI5XTT QbM0WUIBIcGmq38+OgUsMYu4NzLu7uZFAcmp6h8g Organization: Linaro Developer Services In-Reply-To: <20231009090446.4043798-1-make_ruc2021@163.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=2.7 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Mon, 09 Oct 2023 02:13:35 -0700 (PDT) X-Spam-Level: ** On 09/10/2023 11:04, Ma Ke wrote: > In tpg110_get_modes(), the return value of drm_mode_duplicate() is > assigned to mode, which will lead to a NULL pointer dereference on > failure of drm_mode_duplicate(). Add a check to avoid npd. > > Signed-off-by: Ma Ke > --- > drivers/gpu/drm/panel/panel-tpo-tpg110.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/drivers/gpu/drm/panel/panel-tpo-tpg110.c b/drivers/gpu/drm/panel/panel-tpo-tpg110.c > index 845304435e23..f6a212e542cb 100644 > --- a/drivers/gpu/drm/panel/panel-tpo-tpg110.c > +++ b/drivers/gpu/drm/panel/panel-tpo-tpg110.c > @@ -379,6 +379,8 @@ static int tpg110_get_modes(struct drm_panel *panel, > connector->display_info.bus_flags = tpg->panel_mode->bus_flags; > > mode = drm_mode_duplicate(connector->dev, &tpg->panel_mode->mode); > + if (!mode) > + return -ENOMEM; > drm_mode_set_name(mode); > mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED; > Reviewed-by: Neil Armstrong