From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.218.48 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796223156; b=Oaw50ikQfPlBK+U9mHzqcyS4EdIiIrDFVmq+Ol0TYBzbIkSjPJGDEu3R8xfTtTNsqadC 9MjrNNUq8fxOzkIDUpNr/A85DJjymsSzt9TeFjoAnEX6nzCayIVfn9rF4Erv+8R03uep0 EEqu5T26QhicTyg6aBxIduO5m4Ct5+Quj5I0sRxNaH5uEfwRghdu0aXcOGb7DZc68lTn/ Rlfk9Fv/zQJRZM7x4OwWLl/ro1ovuHCXqmKhuHJt0S7isrx6QX5mIrfHMHtZzx9Zxsa/H CWNpkKBSl7O1bYBiU2wapPhKzoOfCNy21/B+c/Nc6KI2CBHCLBrm+Qx6SIVvNsp8USA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796223156; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: Message-ID:Date:MIME-Version:User-Agent:Subject:To:Cc:References: Content-Language:From:In-Reply-To:Content-Type: Content-Transfer-Encoding; bh=SIvzkzKkXUl1DrN7Pj5Y3w81BdVbz9lcMEMWJtZ6Ln0=; b=sRTgBFrFPiu0y/lQqcPRuTywwS0O2VlHucVCkMxaiKCENfrfH9Q8rgiR4A+fHLAXzdBF +P6aAjnHJ4t5qhvVyaTN7f8P+6BklqTtM7PaugnmWa6BjeinoVBkwCfAF9BLt4PwJlesN bVxuF0/yReEzyPZtt6C0XRVfocJJO+nUv/4j/XI8Jc5+Yqhg65Zh/WtR/+RP1+W/+O8Go uhiRWLTfqnA8i+5wnl7c3rkz3DNEvFG+ORkc5ORiu9dabnFd5SlwBHbo7OOLnX+kC8+iP KhTsr4yWJ2y1P5wqfdve8mJ6xfcY0R5bjJXCbKxbu5b6exGRmIodInXYuyHCcyiUGtg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=Xfy6jCdi; arc=none smtp.remote-ip=209.85.218.48 Received: from mail-ej1-f48.google.com (mail-ej1-f48.google.com [209.85.218.48]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 83D56606A330 for ; Wed, 2 Dec 2026 14:52:36 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 83D56606A330 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=Xfy6jCdi Received: by mail-ej1-f48.google.com with SMTP id a640c23a62f3a-c4cac7a7d3cso1980277866b.3 for ; Wed, 02 Dec 2026 06:52:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796223155; x=1796827955; darn=vger.kernel.org; h=content-transfer-encoding:content-type:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:from:to:cc:subject:date:message-id:reply-to :content-type; bh=SIvzkzKkXUl1DrN7Pj5Y3w81BdVbz9lcMEMWJtZ6Ln0=; b=Xfy6jCdiy4cTmm9FGUqg5zJuh4MvUl1mEsLNeHebz9kBv3357nvOqLQOtKygGhx6ma uaM0KIIkSTUAbrGPhAqH9aUd2d4Bk3s0is9fAL3x08wh4r4/Ci3HAJDez/cECnqvIjhH sD1qOxDQORg1VDRvDljKaGgMScdjK8qyXM+vcgUjTZ+w1pvgAi6aCxExWbODwqJS90xf Z5s4Q2oC5k9ezISgxIfr6iUmIDCNYizx9IriAk53nn647AF/Xugj6utRw5wBzonIScSs hDfz9FrAJF2W0aArB3Wn1Gdgd5kY87oNB9okwB4wZkXSaKDCbUoK+YlMshK+Fl9PK+9z LHjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796223155; x=1796827955; h=content-transfer-encoding:content-type:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=SIvzkzKkXUl1DrN7Pj5Y3w81BdVbz9lcMEMWJtZ6Ln0=; b=p/2ooD5VMEnXgfedRyHg9uUsB7bGpuK1eicr34XulXDi/D/Tqa+PweJ2sKGdWmO/a0 ZWUf0JGARh2uHyGOYtgwWmJpWOu1QSn+gSukkGUzsV4iD3tbhAampjKtPvpO0Q3F4r5r Bsas7KsmtakYbynUlCgyodNrKAfuIe9bYHIhSr2Y8dWxa5xYUay1dbN97OjiPLuUbuVr 9rT1lWIqnCmtWd3dTmFn18nIcJphSPseHGvm3NSN+JZqhWc0PpKfLETAcW3RMEqfJjRn 1nW8yexhwBf/YoPD3BEpUEmmdZKEnP96B3E4TCgkyKv1R1vxH0dy9cosbAR7vhklyzh2 hxYQ== X-Forwarded-Encrypted: i=1; AL+hErHluftPwIS94ggNj1iD8Zmc8VOV+dsjSXkv0Xnapm9HxkXho+zRubw8b6poA0ctJnWVg5w4Cg8/dRXJ2To=@vger.kernel.org X-Gm-Message-State: APuU4Z9EbfUQfJdTD2WUA19LcbSYx5hJQAhdkMhVHPC75ZUeURAUZWns HGfuscfJbPT2UWDRtZrSUdZ0in+B7KatOmESuUjQOTQ7hWweUgtt3kHd X-Gm-Gg: AZFdTZcpNP0B/32OvUjQPJnf6OUzWA3JpINK8K2eb8i0V+LjvSOJHpnKF0JrU4czNoU NsnEdVOWXQ+dgjel5SfTZj53V0xRKATJsGUF8EeDwUrt1WtJbM55DCmMo7J3JWJM23e8V10+hrL psOf3JRJGVolXARKIIYEbUQUvlqSBPzQATw8fJK5fgdxT+p+/wS6xNYQMI5jxcuJuEaOjItn/f5 ZtvZuQHi6OugNa84S5mTt7knPhLGYp+CTlAeHERZg2Y0YMiOjp5LH3F3b/z9xTmXcW9ONR495nS HVyyOMtEWVpOKQrfi/q8Um47ieuFvbUwGw2jPhAZbGsyoEH1e5Qh3MSYY3udyKZoTqQMJYEpDmJ cIazBro6TpxvEuwaNiJ6Xf18K1YybZDoLToez5dyi7U6rrlx6oEmhP2TCf9HMaPOCPb26F2HslD nu/gYh6Z0tH5WkzXvlSOB0pI2H6OVVkYea4k8aS4vL25Wgs/gFiXWYuR+0gNgCSlU/5vPeA7OR6 Ayx8DxBr3Fi+yQ4KmIoIRrcGf6xZ0kOafwtG3WINZ9BME98WmJdnUBs7/8V6FXpis9TNslYUgP3 MD8jeNwWfg/w4wLnFIoTPxG92AxrbLFBibsi8YG2yW4wj0rnQus= X-Received: by 2002:a17:907:6024:b0:c41:1e13:8891 with SMTP id a640c23a62f3a-c513a88b0e5mr2212553966b.9.1796223154681; Wed, 02 Dec 2026 06:52:34 -0800 (PST) Received: from [10.10.0.155] ([85.105.252.11]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-c513afeca8dsm1385114366b.75.2026.12.02.06.52.31 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 02 Dec 2026 06:52:34 -0800 (PST) Message-ID: <8c60927c-ba8a-4994-b121-7e259acd5362@gmail.com> Date: Wed, 2 Dec 2026 17:52:29 +0300 X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 1/3] platform/asus: asus-wmi: Fix NULL deref and integer handling in asus_wmi_evaluate_method_buf() To: Denis Benato , Corentin Chary , "Luke D. Jones" , Hans de Goede , =?UTF-8?Q?Ilpo_J=C3=A4rvinen?= Cc: platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org References: <20261202-asus-wmi-eval-buf-v1-0-640c12d437dc@gmail.com> <20261202-asus-wmi-eval-buf-v1-1-640c12d437dc@gmail.com> <37360523-462d-42f0-98e0-cf45d4646398@linux.dev> Content-Language: en-US From: bartu alev In-Reply-To: <37360523-462d-42f0-98e0-cf45d4646398@linux.dev> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 12/2/26 5:40 AM, Denis Benato wrote: > Hi and thanks for improving this code! I leave my review below. > > > This code, after applying the patch reads as this: > > if obj is null and no memory is allocated go to deallocate memory of obj. > > I understand that you are preparing for patch 2 and the __free conversion > here... but probably converting it into __free right away would have been > better. > > You can still split it up, but patches need to have coherent code, if you > really think the dual patch is the way to go rename out_free into > asus_wmi_evaluate_method_err and move it below the kfree and > that way the will be coherent again. |Hi Denis, thanks for the review! Good point, jumping to out_free when obj is NULL reads oddly. Patch 1/3 is meant for -stable (back to v5.17, where cleanup.h and the -Wdeclaration-after-statement drop from 6.5 do not exist yet, so 6.1 LTS would fail to build with __free()), and patch 2/3 is the -next cleanup. I did spell that out in the cover letter, though I know u rarely get read :-) Even cleaner than moving the label below kfree(): since no cleanup is needed when obj is NULL, if (!obj) can log and return -ENODATA directly (matching the ACPI_FAILURE check right above it). That removes the goto entirely from 1/3 and keeps 2/3 from touching those lines again. also see Ilpo suggestion|