Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp970319pxu; Wed, 16 Dec 2020 21:31:30 -0800 (PST) X-Google-Smtp-Source: ABdhPJzVyDXITOZGUn4bR2uhlGmX59fkiYr7wGi8gNiwpzn7xCSqkfeUst5fzuXkZAnNZi8t0HcL X-Received: by 2002:a05:6402:44b:: with SMTP id p11mr36934764edw.164.1608183089901; Wed, 16 Dec 2020 21:31:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608183089; cv=none; d=google.com; s=arc-20160816; b=jFgFC3O7c0S1bb1leWVNoYvKN2D11e86Pigj+d9d+sQI9EFfiZHwJHYl0D8gKzJYtS v5JtKOWkl3dBOrEx8B5UKBFUsixGG7/J/a/VRzUZUNgCQu4/AI6bbTfn9co1G2R0OzpV C7h1p2Qr3RTf5h9hTgAK0K14dV0nHsaJLAoXYAQt892qR/8o6cBU7h3A5/fsNYFnswjV 4NLBo6fRpaivRXHoJuj/g1jXfDMkt2bkQ2Z/7Iy6dspct/tTw+MVmYzo+L4Str/ycOh4 yI5pA4P/sCoMAd0DzqaoR4Szdx3B0QdvtWItGjBAjnua9ux+f+Qk5gsC17isRz7kliVK fPEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from :dkim-signature; bh=PTl0THDgn2AwC8r+qfcc/Bz2DnZdRIJWemtVkiRjcyw=; b=ucFcbaX0grZf29QhbjqY7up0KH+6om/sPmBAEhgceM7FhnPKnSkqX7BQhdc1PP+33x 1hivvsljtbREizg4q/VWrr2n8LKQ958kjb8/uLjOu9KyLZ/OOUkpMTDPMCTAIrCwi3Uu jJh8A2kk9ZBBMY8yaUpH8y3+gFbhdc01R9LmOqX5QrRKCeDyaOKeKzFYZ/fAzIlA3+Xs 6oxf+ZF9OCNzA5QCLffz3xQZw1vSvz+7RtV5fIPV0yKONtN4RiqQPzV4X45sm4+akRdL bv4l6MILFyEpygVIWdG5dVnTSkYzBTLVOVIEfy9Gpsd755scCF6KxrpUtWxkV781yIpl 043g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=sV54iQ31; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id rh5si2027099ejb.488.2020.12.16.21.31.06; Wed, 16 Dec 2020 21:31:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=sV54iQ31; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726012AbgLQF33 (ORCPT + 99 others); Thu, 17 Dec 2020 00:29:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37954 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725930AbgLQF33 (ORCPT ); Thu, 17 Dec 2020 00:29:29 -0500 Received: from mail-pl1-x632.google.com (mail-pl1-x632.google.com [IPv6:2607:f8b0:4864:20::632]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1B817C061794 for ; Wed, 16 Dec 2020 21:28:49 -0800 (PST) Received: by mail-pl1-x632.google.com with SMTP id b8so8519207plx.0 for ; Wed, 16 Dec 2020 21:28:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=PTl0THDgn2AwC8r+qfcc/Bz2DnZdRIJWemtVkiRjcyw=; b=sV54iQ31ZWag4sHjxIiH/QQtEUskh3ORZUYZ182bmOyhiWsVJ/Er7htgqmFD6JaHmB IGy9y5qrktAzor6ioV7/bRwAF0VxFS1Qj5XrF6XxEs8qzJBX+bvAuqQQ1RgZYfUqKwcW JGvMOxKm5aGWidpI3gKlVTR0sgaIibe2aCzGTRgs35ClQTc7vgYOr8BhdXM+hGscQego 0PDtXQZX7Zcd4gHetOu+RxO6S+b1TvtjN4ekUEu8EkbP2zfCl9vGnzikryC2XVgOB+5O Ouk1X0FONj7bBQdeZ9OJI40ooLsKRKvyHuSuTUgjP7VN+3psTzZI/zeggoQEEQFQCuTW 1wZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=PTl0THDgn2AwC8r+qfcc/Bz2DnZdRIJWemtVkiRjcyw=; b=JwPwlF9QXrudOBNgwF1Z+KaHqsz5vf0dCsCemSLKk/HgBMlFMO+uV492tUrKYx7h+F 4LT/ti/bndsFF/ZKAuweM30GWW+JTNsn/h3y06ianf+M8/6iJyKjPmMDJpPy/INNCFPV b2t+WOLisfxpIlZV+tUw9roVPqgMgAlWDyaRpjmQpLCc3Qwb8GG95ZOSSKYRR1bbUjiR RcvlGRivskny+g1l1iHmAudbl2Z6cWaJnA6I4szDm2qLHEFNUINHtciUaeCjTsDlKU4F 7bguSzi2T4KhQBUB8gGgFHIOsu4LRs0bY5GDXNzO/rwNpNKNn32svEXl9PAbwCRkPyUt Lucw== X-Gm-Message-State: AOAM532OrJR6jHA/bTgymKcYw39/wU6Y2PtaX0NaXcIOF3H7W/Y1srTv N4dE4w6y5zgoi7vEedoWOOOmdu1sPaFbIiz9 X-Received: by 2002:a17:902:bf06:b029:dc:1f:ac61 with SMTP id bi6-20020a170902bf06b02900dc001fac61mr6102355plb.16.1608182928400; Wed, 16 Dec 2020 21:28:48 -0800 (PST) Received: from AHUANG12-1LT7M0.lenovo.com (118-171-80-86.dynamic-ip.hinet.net. [118.171.80.86]) by smtp.gmail.com with ESMTPSA id fs12sm3601478pjb.49.2020.12.16.21.28.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Dec 2020 21:28:47 -0800 (PST) From: Adrian Huang To: linux-kernel@vger.kernel.org, x86@kernel.org Cc: Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H . Peter Anvin" , Adrian Huang , Adrian Huang Subject: [PATCH 1/1] x86/mm: Refine mmap syscall implementation Date: Thu, 17 Dec 2020 13:26:48 +0800 Message-Id: <20201217052648.24656-1-adrianhuang0701@gmail.com> X-Mailer: git-send-email 2.17.1 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Adrian Huang It is unnecessary to use the local variable 'error' in the mmap syscall implementation function, so use the return statement instead of it. Signed-off-by: Adrian Huang --- arch/x86/kernel/sys_x86_64.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/arch/x86/kernel/sys_x86_64.c b/arch/x86/kernel/sys_x86_64.c index 504fa5425bce..660b78827638 100644 --- a/arch/x86/kernel/sys_x86_64.c +++ b/arch/x86/kernel/sys_x86_64.c @@ -90,14 +90,10 @@ SYSCALL_DEFINE6(mmap, unsigned long, addr, unsigned long, len, unsigned long, prot, unsigned long, flags, unsigned long, fd, unsigned long, off) { - long error; - error = -EINVAL; if (off & ~PAGE_MASK) - goto out; + return -EINVAL; - error = ksys_mmap_pgoff(addr, len, prot, flags, fd, off >> PAGE_SHIFT); -out: - return error; + return ksys_mmap_pgoff(addr, len, prot, flags, fd, off >> PAGE_SHIFT); } static void find_start_end(unsigned long addr, unsigned long flags, -- 2.17.1