Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp2181170rwb; Mon, 7 Nov 2022 10:05:42 -0800 (PST) X-Google-Smtp-Source: AMsMyM76nwANnl35oZnQYejx3UGltOyT3pvnoCZIem+jVEWxIUh6kHr41gn0PNOcGbhrJohnWnDE X-Received: by 2002:a17:906:cc5e:b0:7ad:ad3a:b20a with SMTP id mm30-20020a170906cc5e00b007adad3ab20amr48079181ejb.315.1667844342583; Mon, 07 Nov 2022 10:05:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667844342; cv=none; d=google.com; s=arc-20160816; b=wpl2GC0r+fzuxtAQn5IXhQMEYlUkDCIrpSLcO5P9sppamiWwKhm/2WERP6BqeEoHJK V9hwYayuOmy4hu7ZaP8NN0wz4EYCyIcN1sgEE4CvokVEmHFBHwEi6Uv83VoFe8NbGqhF RkB7rI47xmxuGtJb+qRWj+lVStIfkTym7euL9pmqdeAcawK55UKcKlEEiw4Ile3NUdj8 CmNwI4crYs0vGQDXa1YeYgKCqYbRUhuTxF1WNAVIVfoOsjIXJ+bpcCa3heTEQuy5QC/w Q2jhnEQT3PBRD4Uv/yRoOIn71WeFXVOtJ5K1tUgjucc//Xz45FmOavfZP3MDi4DjOPyW YvJA== 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:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature:dkim-filter; bh=yldvO65QURVLOQ7Eu8yQmh08iZtI+puhXJFbyAVBGns=; b=zGTfFJ0Rmmi8Qw4ICTWEDzg6wafn3JP2GIuq8++MFB6S0n0bmo6jWF2TcPWQWecIND UMnmsDH1sP+do1/Mn18LfvdUGDsbKKeIpbq0uiIa6kplMufGWqapseBh81J+UVNP2AVn Ju6cfvR33n3qo29N54WGx45pmSVMI7JZheMzxrnRw2MEjRmWKQZ8V2EiAWkbdBpsXUhJ BpJql+csM3PH8Ryw3/FRcfsQqtKuR5XDnJxLbPC+zVLLCQECCjRSmanIdI3hsryXw5Pd NEXWgO/vGdbeSkl587yLlNLf4bZUvamyY7DVDxLfKazpKO8Iz0XliumdMGi/MLYbPXir XHGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@zytor.com header.s=2022110601 header.b=Ts+8JfFS; 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=pass (p=NONE sp=NONE dis=NONE) header.from=zytor.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c12-20020a056402120c00b004615a57e292si8145192edw.426.2022.11.07.10.05.13; Mon, 07 Nov 2022 10:05:42 -0800 (PST) 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; dkim=pass header.i=@zytor.com header.s=2022110601 header.b=Ts+8JfFS; 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=pass (p=NONE sp=NONE dis=NONE) header.from=zytor.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232849AbiKGRbU (ORCPT + 92 others); Mon, 7 Nov 2022 12:31:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44094 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232272AbiKGRbR (ORCPT ); Mon, 7 Nov 2022 12:31:17 -0500 Received: from mail.zytor.com (unknown [IPv6:2607:7c80:54:3::138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2BE1B20BE0; Mon, 7 Nov 2022 09:31:16 -0800 (PST) Received: from [IPV6:2601:646:8600:40c0:425:cd56:6750:e1bf] ([IPv6:2601:646:8600:40c0:425:cd56:6750:e1bf]) (authenticated bits=0) by mail.zytor.com (8.17.1/8.17.1) with ESMTPSA id 2A7HUiHJ1044882 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NO); Mon, 7 Nov 2022 09:30:44 -0800 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.zytor.com 2A7HUiHJ1044882 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zytor.com; s=2022110601; t=1667842245; bh=yldvO65QURVLOQ7Eu8yQmh08iZtI+puhXJFbyAVBGns=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=Ts+8JfFS9U5gE76qXBy36Fxnu/t51z0u9ib2f3FnRwGnriurXpu3uIAsq2f3HsfW9 L1avUXX9FJncq4LvkA5QMJ9kzdYGUFMZRA/94UKJsDHyF/OMLc5BGUwotO4PIqHMLL 2gmbXUpqw5KorSHZKZ2KzyWHXJQ+8PGv1dln1tVgpHpyFIUCaJM5V6wfLehQGL1mgG 7mr3Bv6f1gxUNyXxiAxAllXj+JmESR361dhNASGeEaVssTONBjpGw7HgIissdsHljl oT3iG1XqwRygw5Cm89KAKsgFZLoU7PFHOFdymVY6ZAIWRsGJxA+7ohMFD4YZAKQK1f Bke17H4vFNPBw== Message-ID: Date: Mon, 7 Nov 2022 09:30:38 -0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.1 Subject: Re: [PATCH linux-next] KVM: x86: Replace IS_ERR() with IS_ERR_VALUE() Content-Language: en-US To: yexingchen116@gmail.com, seanjc@google.com Cc: pbonzini@redhat.com, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, ye xingchen References: <20221020113943.400103-1-ye.xingchen@zte.com.cn> From: "H. Peter Anvin" In-Reply-To: <20221020113943.400103-1-ye.xingchen@zte.com.cn> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RDNS_NONE, SPF_HELO_PASS,SPF_PASS autolearn=no 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 On 10/20/22 04:39, yexingchen116@gmail.com wrote: > From: ye xingchen > > Avoid type casts that are needed for IS_ERR() and use > IS_ERR_VALUE() instead. > > Signed-off-by: ye xingchen > --- > arch/x86/kvm/x86.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c > index 4bd5f8a751de..1c260f716c3b 100644 > --- a/arch/x86/kvm/x86.c > +++ b/arch/x86/kvm/x86.c > @@ -12414,7 +12414,7 @@ void __user * __x86_set_memory_region(struct kvm *kvm, int id, gpa_t gpa, > */ > hva = vm_mmap(NULL, 0, size, PROT_READ | PROT_WRITE, > MAP_SHARED | MAP_ANONYMOUS, 0); > - if (IS_ERR((void *)hva)) > + if (IS_ERR_VALUE(hva)) > return (void __user *)hva; > } else { > if (!slot || !slot->npages) This seems to imply IS_ERR() is misdesigned. It would be nice to have IS_ERR() contain the appropriate casts. If we want to enforce that the argument is a pointer, add IS_ERR_PTR()? -hpa