From patchwork Tue Nov 15 03:17:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bo Liu X-Patchwork-Id: 20165 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2497392wru; Mon, 14 Nov 2022 19:29:19 -0800 (PST) X-Google-Smtp-Source: AA0mqf4OXjW6m6Dx3zKhad37o/XRsIjumG56BHulZT+rDSSj5xZhJbgAoCHduCM1qXtrNwpk0z7U X-Received: by 2002:a17:90b:24a:b0:213:c7ce:ea6f with SMTP id fz10-20020a17090b024a00b00213c7ceea6fmr233179pjb.27.1668482959148; Mon, 14 Nov 2022 19:29:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668482959; cv=none; d=google.com; s=arc-20160816; b=POQavat0jEbewb648ZIBy9b8P0GI148ZCY0WLhObjPyky2plLSUAeLgWodd8SnTCMH e3jGfg8xAB52l1vMhfVP+kBcPXYHcKGlN/AWF0z4Ik5ksQoJarVM34UaZ3FK87xZt5fw jYcVUq+1vn8Ar2ycF/KxsvmyqXAf+q3AsUpqMrac0/v3/+x4ykRB7NeftjTI1VHjArcv ArFOGPUhiR3Oenw+BkcnoY3l+tZMKnj18EKcY3/MQafKbqJjEyO9prZq7+fH9cr3E2+B JHSbCQssc2yqZp9nPQ/fgqtTxftjr2odVd+OIaDaITmqm7jN1yrTgYkRWRE56E6+EUBG CaPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:abuse-reports-to:tuid:mime-version:message-id :date:subject:cc:to:from; bh=4RVJBELiWytDFwBcHcydZPGe4xSGwTz6ZMRyW4i1t24=; b=TAcmtx0EKYtW79e9B4C3jEPVbwDGPyJvAFVOOUdh22cg5rjSjr9yr6Vj38bJrPdnEa D/RZLS7u1xRpv0uCpVkAZuo7Rhf/sNPaK5bZArWLQty+/43iRbpEiJsIG1kM4hEb/oFv D9wfvd+vYMc9z72H1U2+0JxAs73IaqG0EoxxQ9/bnRB9HXS4T+NcLgjKGiCCFyARftZg n8y61pIIZumCQ9qqr6IAhZH5tBFCUZlKrrVmfiSY7vgyLEh2KUwyJUMKBkfyiOkGybbi /Eo5LUiqQXjyObIx/8wKhXlWoreThP55L2D+ESQ0iLYT0lAob1fiC6FQ0VFj8gnYxBD9 ZxRw== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y5-20020a170902d64500b00188569964fdsi9983709plh.512.2022.11.14.19.29.05; Mon, 14 Nov 2022 19:29:19 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237444AbiKODSG (ORCPT + 99 others); Mon, 14 Nov 2022 22:18:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57980 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236825AbiKODSF (ORCPT ); Mon, 14 Nov 2022 22:18:05 -0500 Received: from unicom146.biz-email.net (unicom146.biz-email.net [210.51.26.146]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0320D15A3E; Mon, 14 Nov 2022 19:18:03 -0800 (PST) Received: from ([60.208.111.195]) by unicom146.biz-email.net ((D)) with ASMTP (SSL) id JEG00156; Tue, 15 Nov 2022 11:17:56 +0800 Received: from localhost.localdomain (10.200.104.97) by jtjnmail201602.home.langchao.com (10.100.2.2) with Microsoft SMTP Server id 15.1.2507.12; Tue, 15 Nov 2022 11:17:59 +0800 From: Bo Liu To: , , CC: , , , Bo Liu Subject: [PATCH] binfmt_elf: replace IS_ERR() with IS_ERR_VALUE() Date: Mon, 14 Nov 2022 22:17:57 -0500 Message-ID: <20221115031757.2426-1-liubo03@inspur.com> X-Mailer: git-send-email 2.18.2 MIME-Version: 1.0 X-Originating-IP: [10.200.104.97] tUid: 20221115111756b87c5982aa519fccab65dc704674a7a4 X-Abuse-Reports-To: service@corp-email.com Abuse-Reports-To: service@corp-email.com X-Complaints-To: service@corp-email.com X-Report-Abuse-To: service@corp-email.com X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_PASS 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749531187379666618?= X-GMAIL-MSGID: =?utf-8?q?1749531187379666618?= Avoid typecasts that are needed for IS_ERR() and use IS_ERR_VALUE() instead. Signed-off-by: Bo Liu --- fs/binfmt_elf.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c index 528e2ac8931f..d9af34f816a9 100644 --- a/fs/binfmt_elf.c +++ b/fs/binfmt_elf.c @@ -1160,7 +1160,7 @@ static int load_elf_binary(struct linux_binprm *bprm) error = elf_map(bprm->file, load_bias + vaddr, elf_ppnt, elf_prot, elf_flags, total_size); if (BAD_ADDR(error)) { - retval = IS_ERR((void *)error) ? + retval = IS_ERR_VALUE(error) ? PTR_ERR((void*)error) : -EINVAL; goto out_free_dentry; } @@ -1245,7 +1245,7 @@ static int load_elf_binary(struct linux_binprm *bprm) interpreter, load_bias, interp_elf_phdata, &arch_state); - if (!IS_ERR((void *)elf_entry)) { + if (!IS_ERR_VALUE(elf_entry)) { /* * load_elf_interp() returns relocation * adjustment @@ -1254,7 +1254,7 @@ static int load_elf_binary(struct linux_binprm *bprm) elf_entry += interp_elf_ex->e_entry; } if (BAD_ADDR(elf_entry)) { - retval = IS_ERR((void *)elf_entry) ? + retval = IS_ERR_VALUE(elf_entry) ? (int)elf_entry : -EINVAL; goto out_free_dentry; }