Received: by 2002:ab2:3350:0:b0:1f4:6588:b3a7 with SMTP id o16csp1921848lqe; Tue, 9 Apr 2024 04:53:36 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCU3RtSmzK/KwPBn3W2zaiKFEgu1B2gZDKBOj3WsTdL8SrN6owEaBotQ2np3dI83eUHo5Bf22+e4oc7Q2FL9mlyFjbogaIc+EBD20DOkHA== X-Google-Smtp-Source: AGHT+IFieJGVpmdih/It2p58hL6PlE81QCCEgxrjddXsA5UkS0vrxwPEhgBYlwyhL9SYgaYpov7c X-Received: by 2002:a05:622a:492:b0:434:e71b:f9e1 with SMTP id p18-20020a05622a049200b00434e71bf9e1mr881128qtx.10.1712663616356; Tue, 09 Apr 2024 04:53:36 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712663616; cv=pass; d=google.com; s=arc-20160816; b=Y0rrcnd3HDQwkyhOJZvCmZknL/61vZrq6u5vtBQaDBdejMcdEObRFlzllEsuHuRJ27 5T/zFqb7qRiuDgu+WcBxzG+01WDQEHMF+a4MAOeH4WtUwBOTMGUJy+i5uj6fOUd+D4S6 PpLyKKsQmlQs/7azuRvWteWYPIYyECiwKqwE3g7RSulUEMwwZ2fz/dBgBgmXecjWgDWe iuud2snFaAKetxvzilf9rFMJgVV7XhL2bgLNLh4fFrQowiFH01YRrv7uSobcSZ3EqveD O3Jxd40gjSjCNMpeDXlcwyBXEMc/CozSxLe4ej0m0VYAPsvnxvFRtWKCZIX1Qt7WEyDp 7tnQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:autocrypt:from :content-language:references:cc:to:subject:user-agent:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:date:message-id :dkim-signature; bh=mwibmhabQtaTTaSfxj4uJT6v1DFOIACmKb5/eqDC61c=; fh=VoW1/qRi53qGUEDbBC7A+hbhriR/t6zq6JvVDD1xsRg=; b=ak8K1c+FQhqm+XjZb8JnjadARm5B3e9eS+dabpdY5plqWyshI+5bJV2JDE+xMFrwCE 8qNm56NZOsvSoAqBRHxM5IlmXRRU24cLhPR94qmeuZIiCzapKMMGjUH6YhrM+adOlaxa CyT9+g3Y6nZeykp7OJ9iof36j9ynND5Veg8980ZHOx3gu1PARGFqVJCHyQQ3GxjkjuOV sYMOxrG1z6vICRWTDCUCjzsxSnBJ/Aht1kU62DLm+UcSGZ5yAd5zwsG3LKWS22HW9il9 AnO/1HmlPfOLFFXMAJ5rDNSa1cmI3CqVYhkhcKb30WRog1VAGGVJ+hhmumMJMCwj5sTa 6Zfw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mX1cfYfE; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-136814-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-136814-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id z8-20020ac87f88000000b004347cd84569si4649958qtj.155.2024.04.09.04.53.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Apr 2024 04:53:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-136814-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mX1cfYfE; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-136814-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-136814-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 329151C2144C for ; Tue, 9 Apr 2024 11:53:27 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DD69412AAD3; Tue, 9 Apr 2024 11:53:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="mX1cfYfE" Received: from mail-wm1-f53.google.com (mail-wm1-f53.google.com [209.85.128.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 040F712AAF0 for ; Tue, 9 Apr 2024 11:53:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.53 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712663587; cv=none; b=MEhg8rmwSqlRubU4aGhW/mVURiAdbyyB/oCEjvurVzuoe/0RfT14tcFiMTtKbGfogPVhZ+uCUGoCQUD7LSIAjb5dRQ+AYBbM63viKKDMKaTP8UaouhycpnbjvdNJYkE+oE4EizbIp0yQeBUibZV1Ojcx0/WadpJfHDG/l9a62b4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712663587; c=relaxed/simple; bh=ewn/5uPthLhb/zMjw/qMCDDEVnM4Cko7tvC5qsRH37E=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=CsgZsR+1TcZqf66oNvLszdRsOm14Nxz15Fyk408Kd30i7OE0qi5HJMEL9w7NUgi7NQUSMcK2jHSfFBLp6RKWpA0s0pj7eMw7dExkxpFVg5UeUekQ7VMBn9HVd1+mudZgQmUraPrrGJgF8F/0JVo6Il1MJMZTM7QBFf/ihqiVrh8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=mX1cfYfE; arc=none smtp.client-ip=209.85.128.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-wm1-f53.google.com with SMTP id 5b1f17b1804b1-4167fce0a41so9981165e9.0 for ; Tue, 09 Apr 2024 04:53:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712663584; x=1713268384; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:autocrypt:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:from:to:cc:subject:date:message-id:reply-to; bh=mwibmhabQtaTTaSfxj4uJT6v1DFOIACmKb5/eqDC61c=; b=mX1cfYfEErCgpNJGJab9lICS8F022qp8Xo/zcdRUrnB/+hFtZYaMV7tluTTs3Svv3t yVRZtF2aGNp3W/WqQdxW23pv8DTpf4J6c7ZMh7bL8yhpgM70/jWxQx0V7R3SbQzpyeQQ nml75MWaWZFjwuR0gTUzZoLJEmzCaW0qH6yiaoyutwjONhTCA/QVrM56WfPhzDMA1E0t QlLZ5h0EeMnkxM83oqnbUKLgGbYqqZlu4NH+rbZKKyzdVfB6P/pi9+QVLp+y/FahU/Gg perp8WhT9+d5LZJBeURNkwkuE6BlhAQ6d9SKzAUo2jN4tcaRoYLCvgnByymEg0K6mrpU EvbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712663584; x=1713268384; h=content-transfer-encoding:in-reply-to:autocrypt:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=mwibmhabQtaTTaSfxj4uJT6v1DFOIACmKb5/eqDC61c=; b=QSuzODaty0HCOUKs4H4/3nf2B9hAS4nkLyOyE62VbIJhD3dhl0ye5HcOTvTlbLII5R Bvci5FrU3gfVquZQrjzj5NJU2I/xIOFpH2oKiH6Jhw2UJ/XVe4Ii9WCEWjHVk+yZ4IW5 3BhwymZtlM390wfRrIrvccMXPTOwjhuB3GUK7JDK0tmuRAq7krPGlj30wCGosCADdIoy t3YIY2fyhRFGGhPdEOFlkBCK6eTEYNjTPccZ75wpzxYfW9g81nj03dDA3200FxRN0gHe xRZFpw2okLYwNYp1gCiSGnhjeUQcI6g5Pl8l9QwQH8Rw6Ew46ESR1UkGTEqUCsM7qJXV 72Vw== X-Forwarded-Encrypted: i=1; AJvYcCVuhtlqUD/keONSSiiuHY7F7ORicKdWUBM5he98pcir9v9i6ZNXGq6WEIoApqIjp3vtu5I/7nF31XGuo9sa0CgSXbnlKIZmppnPouUB X-Gm-Message-State: AOJu0YzVePbh1l6ZD9IuK83xYomH/QGg5Bj+Sq7L7emcWDt5VqHEviZ4 j271QCRn5vQBqEr9oeQ7G93mQSmBfPNLZES68TSWxHJM2b5amjxcInNTdl7VS/8= X-Received: by 2002:a05:600c:4f0f:b0:416:71ac:1bef with SMTP id l15-20020a05600c4f0f00b0041671ac1befmr1899348wmq.13.1712663584212; Tue, 09 Apr 2024 04:53:04 -0700 (PDT) Received: from [192.168.1.20] ([178.197.223.16]) by smtp.gmail.com with ESMTPSA id p14-20020a05600c358e00b0041674bf7d4csm7001664wmq.48.2024.04.09.04.53.03 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 09 Apr 2024 04:53:03 -0700 (PDT) Message-ID: <30318fcc-5d6b-427b-855d-f69bcc165a54@linaro.org> Date: Tue, 9 Apr 2024 13:53:02 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] pinctrl: apple-gpio: Fix null pointer dereference in apple_gpio_pinctrl_probe() To: Ma Ke , marcan@marcan.st, sven@svenpeter.dev, alyssa@rosenzweig.io, linus.walleij@linaro.org Cc: asahi@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org References: <20240409110254.2201457-1-make_ruc2021@163.com> Content-Language: en-US From: Krzysztof Kozlowski Autocrypt: addr=krzysztof.kozlowski@linaro.org; keydata= xsFNBFVDQq4BEAC6KeLOfFsAvFMBsrCrJ2bCalhPv5+KQF2PS2+iwZI8BpRZoV+Bd5kWvN79 cFgcqTTuNHjAvxtUG8pQgGTHAObYs6xeYJtjUH0ZX6ndJ33FJYf5V3yXqqjcZ30FgHzJCFUu JMp7PSyMPzpUXfU12yfcRYVEMQrmplNZssmYhiTeVicuOOypWugZKVLGNm0IweVCaZ/DJDIH gNbpvVwjcKYrx85m9cBVEBUGaQP6AT7qlVCkrf50v8bofSIyVa2xmubbAwwFA1oxoOusjPIE J3iadrwpFvsZjF5uHAKS+7wHLoW9hVzOnLbX6ajk5Hf8Pb1m+VH/E8bPBNNYKkfTtypTDUCj NYcd27tjnXfG+SDs/EXNUAIRefCyvaRG7oRYF3Ec+2RgQDRnmmjCjoQNbFrJvJkFHlPeHaeS BosGY+XWKydnmsfY7SSnjAzLUGAFhLd/XDVpb1Een2XucPpKvt9ORF+48gy12FA5GduRLhQU vK4tU7ojoem/G23PcowM1CwPurC8sAVsQb9KmwTGh7rVz3ks3w/zfGBy3+WmLg++C2Wct6nM Pd8/6CBVjEWqD06/RjI2AnjIq5fSEH/BIfXXfC68nMp9BZoy3So4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ZftdybIzpMZ5V9v45lUwmdnMrSzZVgC4jRGXzsU EViBQt2CopXtHtYfPAO5nAkIvKSNp3jmGxZw4aTc5xoAZBLo0OV+Ezo71pg3AYvq0a3/oGRG KQ06ztUMRrj8eVtpImjsWCd0bDWRaaR4vqhCHvAG9iWXZu4qh3ipie2Y0oSJygcZT7H3UZxq fyYKiqEmRuqsvv6dcbblD8ZLkz1EVZL6djImH5zc5x8qpVxlA0A0i23v5QvN00m6G9NFF0Le D2GYIS41Kv4Isx2dEFh+/Q== In-Reply-To: <20240409110254.2201457-1-make_ruc2021@163.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 09/04/2024 13:02, Ma Ke wrote: > devm_kasprintf() returns a pointer to dynamically allocated memory which > can be NULL upon failure. We add a check to ensure that failure does not > occur. > Subject: I doubt that there is null pointer dereference... Don't just copy existing commit msgs or subjects without adjusting to real case. > Signed-off-by: Ma Ke > --- > drivers/pinctrl/pinctrl-apple-gpio.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/drivers/pinctrl/pinctrl-apple-gpio.c b/drivers/pinctrl/pinctrl-apple-gpio.c > index 3751c7de37aa..af2f90d1950f 100644 > --- a/drivers/pinctrl/pinctrl-apple-gpio.c > +++ b/drivers/pinctrl/pinctrl-apple-gpio.c > @@ -474,6 +474,8 @@ static int apple_gpio_pinctrl_probe(struct platform_device *pdev) > for (i = 0; i < npins; i++) { > pins[i].number = i; > pins[i].name = devm_kasprintf(&pdev->dev, GFP_KERNEL, "PIN%u", i); > + if (!pins[i].name) > + return -ENOMEM; > pins[i].drv_data = pctl; The check is a bit later, so please be more precise how do you fix it and how did you reproduced it. Maybe checking earlier is reasonable, maybe is redundant. You did not address it... Best regards, Krzysztof