Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp2062182rwb; Thu, 27 Jul 2023 01:07:51 -0700 (PDT) X-Google-Smtp-Source: APBJJlFYW6lXwa0XIGm/Y/jO+MmqZMQXQCnL5yNzfP3NDzRQKHKOk7YqWCoz5gu0uLQfVGw+SE9a X-Received: by 2002:a05:6808:d4d:b0:3a1:df63:60cc with SMTP id w13-20020a0568080d4d00b003a1df6360ccmr2381931oik.59.1690445271433; Thu, 27 Jul 2023 01:07:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690445271; cv=none; d=google.com; s=arc-20160816; b=s0+Yye3ANJ6rAtp9m3nXvCv7CFiiHxmCgS4l8qk/TRskLPRk9fw60DrQ1MSGBa+3nT 6an/bGuguwLigsSx6oCKG3a+nOI18Udtns1YRRARegPHdO0JPgYIpCjybnU9KbVpoUKY 6v3iIQLEk+pMbOZT4jzyPkxpE/7tkqVfgtMTl/9YJzeL3+J4n3rqiMrz696cSiTLS5lF i3FxcT0dASz+x9SJcbLz+bmhHuaiyYj7MSyI+B5eH+XC1tcCDvY//+hwYwDSFE3JsqDV nNU2wJ66clVipT0pt3Qfz77MZR9GxTvX3/uk/9/Q0qn0oF5SpBT4kETg7tzb4sCTF1Jz bcJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=OnSfG9IIkqbz/x3CFZErs5ugtbw9lt5Qdk4Jq9TYB2g=; fh=OiaitmkdBqBH4Q3vT/OvIXWkYnJNTDQlQU0aumuZ2xA=; b=cOBXrhPqJdoDQIZ2qYi9XiBLPtuxIK/Ju9g0xFR1XnE5FmT/M+2FxEON2vkhSjeWbs Lv8eQ3dTG9zH5K/S13dXJslODYN9RtzM1u/NHQJetp/kWNBXNtgvAe2pwRJkARMQw06n GfLqkEpQrSXIlzwYVcAAUi+LnLOyYTCY/IjZCmctQvUQXy8f3xTBJCBKk6O3f1XUPLE5 d1Kqo859mIO6uCj1yWxeYS07e6Bai7qqRdco0tzsBOUyE0mykh3MK/fmWpKdQ3Be67+P 7jfWzJ6kDXvKClCYSXlkiFvE26+HtSn3l5qYxAGfHh4UjJLr9NX7qI64ixGBAK8LU8PD GzLQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a10-20020a631a4a000000b00563de62f2bbsi874962pgm.340.2023.07.27.01.07.39; Thu, 27 Jul 2023 01:07:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232558AbjG0HuQ (ORCPT + 99 others); Thu, 27 Jul 2023 03:50:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56596 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232432AbjG0Ht4 (ORCPT ); Thu, 27 Jul 2023 03:49:56 -0400 Received: from out30-131.freemail.mail.aliyun.com (out30-131.freemail.mail.aliyun.com [115.124.30.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 859D3659F for ; Thu, 27 Jul 2023 00:43:14 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R151e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046060;MF=jiapeng.chong@linux.alibaba.com;NM=1;PH=DS;RN=16;SR=0;TI=SMTPD_---0VoJlfUx_1690443778; Received: from localhost(mailfrom:jiapeng.chong@linux.alibaba.com fp:SMTPD_---0VoJlfUx_1690443778) by smtp.aliyun-inc.com; Thu, 27 Jul 2023 15:43:09 +0800 From: Jiapeng Chong To: rostedt@goodmis.org Cc: mhiramat@kernel.org, karolherbst@gmail.com, ppaalanen@gmail.com, dave.hansen@linux.intel.com, luto@kernel.org, peterz@infradead.org, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, x86@kernel.org, hpa@zytor.com, linux-kernel@vger.kernel.org, nouveau@lists.freedesktop.org, Jiapeng Chong , Abaci Robot Subject: [PATCH] x86/mm/kmmio: return -ENOMEM when kzalloc failed Date: Thu, 27 Jul 2023 15:42:56 +0800 Message-Id: <20230727074256.118672-1-jiapeng.chong@linux.alibaba.com> X-Mailer: git-send-email 2.20.1.7.g153144c MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-9.9 required=5.0 tests=BAYES_00, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The driver is using -1 instead of the -ENOMEM defined macro to specify that a buffer allocation failed. arch/x86/mm/kmmio.c:392 add_kmmio_fault_page() warn: returning -1 instead of -ENOMEM is sloppy. Reported-by: Abaci Robot Closes: https://bugzilla.openanolis.cn/show_bug.cgi?id=6002 Signed-off-by: Jiapeng Chong --- arch/x86/mm/kmmio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/mm/kmmio.c b/arch/x86/mm/kmmio.c index 9f82019179e1..9aa5bcf5a836 100644 --- a/arch/x86/mm/kmmio.c +++ b/arch/x86/mm/kmmio.c @@ -389,14 +389,14 @@ static int add_kmmio_fault_page(unsigned long addr) f = kzalloc(sizeof(*f), GFP_ATOMIC); if (!f) - return -1; + return -ENOMEM; f->count = 1; f->addr = addr; if (arm_kmmio_fault_page(f)) { kfree(f); - return -1; + return -ENOMEM; } list_add_rcu(&f->list, kmmio_page_list(f->addr)); -- 2.20.1.7.g153144c