From patchwork Wed Oct 16 20:17:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Liam R. Howlett" X-Patchwork-Id: 13838875 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0DB52D2A555 for ; Wed, 16 Oct 2024 20:18:05 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id F202A6B0083; Wed, 16 Oct 2024 16:18:03 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id ED1E96B0089; Wed, 16 Oct 2024 16:18:03 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id AB0806B0083; Wed, 16 Oct 2024 16:18:03 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 778456B0088 for ; Wed, 16 Oct 2024 16:18:03 -0400 (EDT) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id A7E32140934 for ; Wed, 16 Oct 2024 20:17:52 +0000 (UTC) X-FDA: 82680576258.17.A31704E Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by imf26.hostedemail.com (Postfix) with ESMTP id 3653A140008 for ; Wed, 16 Oct 2024 20:17:53 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=SkfIZHGh; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=fSPNfTLw; arc=pass ("microsoft.com:s=arcselector10001:i=1"); spf=pass (imf26.hostedemail.com: domain of liam.howlett@oracle.com designates 205.220.177.32 as permitted sender) smtp.mailfrom=liam.howlett@oracle.com; dmarc=pass (policy=reject) header.from=oracle.com ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1729109736; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=PuPaBazg2N1hxGMrBWUR5Bk0SIqeJho3EXvfR58ZJtw=; b=wEWLxWWZZwH06fLemxCfDMiEzzh2Fb7/6FrkPC60P3WX1I4Hz2srTu09ZAQjP0nWDmmrO3 7aM31TG2f4O0z76TnelMZSWMa/o5K8JdcqcGyJagYuM6fHjkytz5ReG1MF/R/BrkFTorHm gbCW9EV42y3XTdyHwLZoU4Zix560jjg= ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1729109736; a=rsa-sha256; cv=pass; b=Rp9f1ImicjvgmIdoAS8qCqefgOwGufL5NnBgHPJ3JV5KH9pWCWPd/nw5v1TEoZWQPV9GP3 LX6nzgPdpuP6zcyQCJftXxtL94+caWJYpFKLKX3ar7ueBw8g11uCLJ+aZ0AM1aBtmDUNx8 YaYyhYkiVo6zsXjWMk1QyG7ft75NEI8= ARC-Authentication-Results: i=2; imf26.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=SkfIZHGh; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=fSPNfTLw; arc=pass ("microsoft.com:s=arcselector10001:i=1"); spf=pass (imf26.hostedemail.com: domain of liam.howlett@oracle.com designates 205.220.177.32 as permitted sender) smtp.mailfrom=liam.howlett@oracle.com; dmarc=pass (policy=reject) header.from=oracle.com Received: from pps.filterd (m0333520.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 49GHthie009856; Wed, 16 Oct 2024 20:17:44 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s= corp-2023-11-20; bh=PuPaBazg2N1hxGMrBWUR5Bk0SIqeJho3EXvfR58ZJtw=; b= SkfIZHGh0FvYqbDNN9m6G06GLM6Z4b0YOKVGmY+faw0jdXgMJouml3obyaipbqJC jjtpZ87SvpWSDx1XzbaBPFbyYaqGRJKdensu3sXyMHjVmACKeFf2FROzmWHfr5wj gcpoWcWdGLEvzHIh1eIDQCrOg7j/gsXqjd43wEj7y/gTC9FUlwWnEr3fSsD2wPrB xmEAatGiKIAZuUqpI6Q12MuijlgmFqorXnI4nx3jF9Cxw4o2NGJXZSJgIujHgNQ6 rc7EEsz+/m2Xr+nPhT4DJInGcej3ApWX2574SGRJVsmEXUM6KcQmhuqoAXgaY/ED 9bgGCzoPIsVXwRweFoP8Ew== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 427h5cn4h9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 16 Oct 2024 20:17:43 +0000 (GMT) Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 49GIgMdY026420; Wed, 16 Oct 2024 20:17:42 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2045.outbound.protection.outlook.com [104.47.70.45]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 427fj9b8eg-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 16 Oct 2024 20:17:42 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=U8VMyEuc9rSs82JPmDTepyQcaJVX5Xi6l7VfcMAznDpI1gWRDxNM5MlVVlJD9qxXclNwvifzprNncccpESVZJawZeawCORiGu68Zl4Q0Er9RDw6yVH/FCrhFOEhlt932RR4A1picKIFKT97ncYt6trb8WXZlNqrvQUPlaR//yv4Rlt/MaAUzakYkVTpcOvDnNXsSogA0sdiuVBkkfYGmuIRX6M5r4nzkfQRVuu7VKndEKPpdtxuTJJbNN0Y74r3iqMSQqUzxNAPUSTHG4P/ao1ovMlgsXrt56rPhMxwwbCWDqiv5uveIYcsUzKo0mGpnYlixE1Hjv87fJ41qeBuYug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=PuPaBazg2N1hxGMrBWUR5Bk0SIqeJho3EXvfR58ZJtw=; b=TWuIPiXfc6JsiGrWhIhCDEOmjYduvLFvOnMBD/E2pVRgAe2ysZ1/Yz+bsmuOvhxVQ1z05HZfPsegwzSGiMgT9IO8GbZsRXPkYHd2q+7EjYbKTIlaOKi6188TuwENiL2djtwlOWzHw+U0/c31M53/ygBnJZZnzd6l9vrWZJPlann1ctG/a2fzKMRgKd4ryLXsM2lEkgyxTABrBYvTgoS5YNaanVNewlfFGOFJH8koPzAiz4K9r9MTkFPQ9y9A5JHYa7UqwFpUCWfDraOT8TYagUUopOC9xnTnbYRmt4QW5K6dN6evdpuUA2/BOd0SnjCqeV/L7Z4CyHxImbPoJvaxZQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=PuPaBazg2N1hxGMrBWUR5Bk0SIqeJho3EXvfR58ZJtw=; b=fSPNfTLwBgQ6gG26v8rhfSusoRfTm49FOpH4ao75/2BlqYcCv1tD0fP9/5FqmFuvNbJfltb0VCpefGAIbqHK8ou6PfyxP1Oj7hfaNu9G+dDTxXebHuNhhfZteMOKUW0LI6eINNMn5BXSUwsswHny0gfRvSNkNJElrY6gvMHGpsE= Received: from DS0PR10MB7933.namprd10.prod.outlook.com (2603:10b6:8:1b8::15) by IA0PR10MB7579.namprd10.prod.outlook.com (2603:10b6:208:493::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.18; Wed, 16 Oct 2024 20:17:39 +0000 Received: from DS0PR10MB7933.namprd10.prod.outlook.com ([fe80::2561:85b0:ae8f:9490]) by DS0PR10MB7933.namprd10.prod.outlook.com ([fe80::2561:85b0:ae8f:9490%7]) with mapi id 15.20.8069.016; Wed, 16 Oct 2024 20:17:39 +0000 From: "Liam R. Howlett" To: Andrew Morton Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Lorenzo Stoakes , Jann Horn , David Hildenbrand , Qi Zheng , Kefeng Wang , Jeff Xu , Pedro Falcato , "Liam R. Howlett" Subject: [PATCH 1/2] mm/mremap: Clean up vma_to_resize() Date: Wed, 16 Oct 2024 16:17:17 -0400 Message-ID: <20241016201719.2449143-2-Liam.Howlett@oracle.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241016201719.2449143-1-Liam.Howlett@oracle.com> References: <20241016201719.2449143-1-Liam.Howlett@oracle.com> X-ClientProxiedBy: YT3PR01CA0113.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:85::16) To DS0PR10MB7933.namprd10.prod.outlook.com (2603:10b6:8:1b8::15) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS0PR10MB7933:EE_|IA0PR10MB7579:EE_ X-MS-Office365-Filtering-Correlation-Id: e94b05e5-2f94-4296-53b5-08dcee1f9542 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|366016|376014; X-Microsoft-Antispam-Message-Info: 4CHPm5HspxjH6LKHxxFqtAYZUd4T8hqN/t/QthchO3qoeWcm0cY8jmQdrpxk2yS5BbceYogusCgHXkWijFAaKGLGvdgESJsD8I5HAanLsnjpfqT+gjDP8eKtCN7tCR1AKQzvSX7NBRcuWWQAUC7F7Tb7h77tgLBREGW0T6Qn43rIybv7znbNgqEqumLvHlF+wKpYUY9fW43Cs80ERMV/uRoFn7gNQ/tBqEndBoGHsxCYMdZfODfAtbKeGDcOchcJCb092Letydjet7GIZlfQBSrnusrLAkQ6aTISKzvT7EMyXsfVjltz+zDhpelgbRnwSoNUIYyzD8Vw52NfobUFXN9Oo7w1coS2OOWtlKd8a78CJWBP+COmxCj52VM2AlQtCeujYJY8RZEkt1N5pHhvVpwR80+xS5WL9RLUy9hyyfzq3Fbb+e6oNw62aOW4Q6eaLehMiFRlU7pvdrTukQ7hdEfI3ZcTqMw4KlklftoNYkTcbIOTx0MdenXizGQBez1VSBzkhVq8MVKP6vhb2bb2WMy3CDNgTIJyUl5m/1NDwb/R2PHTFqWnkyvxvj0LfR7M5SAzW3ASq6qCgZ8EWNAlCFqLOHDGgua4ABPAVomOd9l7h9qrNijNRWElfvlbBUosbKqiIMj/tIH6jaDwJtKqucgDGUtJM18/k/qd0f7lt8+K9MHuzQxxW5jIkc8jv/0wlg2euUg4McSGCgbtExbSDreyPy2QF66ROVJL7utZbmSdTSPq2aOyFKIitL3kUYIv6EQ2/yC/9uaYgB8GPdm2EvxxpSCb+Cz3O0IJYh5nTgjyjvKNyltyr2YFTYbjlIc9wzHiazz9kXZTsssQ7soKfeYq2dYJo9zFh8WIZwWNHjNQCbnkRAjoj+3to/uwih51QHWjhz1yLEduWqd5ouYMaYawFFXAHuPfce5ISKKY7pIUp7lwexnsmvEP96A4zBM2piiD2RLPT0SalLaDi7GtkM2V9HmO6bjbO67hz4RePhk7uFWnuHdcSjnSaFxGGAGSnEXRyIi+Q8XWjl+0Ue1ClgNKJsmIeCY/6i0w1MYqtqAir5aFqaXABRJKvjCDIpM8SoQUr2Iop4SpHdn3Z4hvLoWASzI/ZBiD7LX80HhTGk1nqeSRklCEVmWjYFbLuLTqiO4KUQBRZDAKBkaJeCU29aDuRoza80HM0cDLk4495ijVe+5A7mcjqbQ7DvuCbvFGe55Slqoos4eutfAzql1IvpotztIMkiGTnm//THvNS0T4rgyoZ5mex2CuM4gvVB195HLPp1FxORuFSclWTSfJHHlL1BVyNlRnP5UwglOy4QUWvIDjlDec/1cHm8v4gNpM X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DS0PR10MB7933.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(366016)(376014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: D5PJMXtBWu1X7HB8hsOlJmHv/KLYElcntLJRc2xtO3I8u1WkaqsoHTuVSk02QgKeU08ZX38PbeoHwZ9tIdM3HG2V4zhG/QlGhnfu+WUBkDMARpusIhixeXcQ0o3S/BmeEK+LiB/7u5sa9eKYWGjJSZTkJOMtt7X/aXePqcfeL8uY2y4T8bBDLD6BkGcLWREvOlo+X7LaBGDqqJcVKv9kkMZERi5kLmmhlTe1dlIK9mQiiFPUViDwgkOA9zvcvcXET4o4vmTWxEsOj313eOcz6ASM+FN6gN+o7w2ubcFgZn8qIDbcvJ6H82nTNyRgatZZcWDZ7WcCCvnyf5qCHFl+nnBxTsLBzH6ERdy0SDlAvUSyifXGzsNejHH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LhuALIJ3EF73qdJxQoYv7A+Kj6q7rOTm+VeR/M/QAUmGP9m6IkzfmLWFfi6cZVp6aICGlK+RbtPdrsne5EDkzKudqQKRdJfeWB14xN/eLQGlAgDGRx7s9L0lnP3pQeRBOzDMXlF1qw1HnoJ6vMm/EjqMrSBrmKPurOnBLOEipLeBNGaBU7ew== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: YJW63G3iOmmM8QeUxg9+B4iKj/1CJJp33btOyrrhLBdkN8acoI8S2dKHBhVWmWy/If/1qWhnd+dLPwKqUsJTB/dMuZWrUCihWREUyaispgsfeBonRmk5jzIyJ+5lOdgujmwJbP8JiE6Ubu4/NC9Bs2Grl/g4ql7h637YnCLvpqkU1v4ZqthfGlqj9zUfllSGGAf2zV7p+1o1GPUVR/XPzJHiDkiUuTlWJ0gmA6aKdBzD7TApJa8iUfthsrUaafm9zSolFfZqkEfpOThnVtXEKINDwcf9oDxe53ged5IMOYLLBRGCEM7lyBzd24nzdh74eQStx86pkxws45m9ZvrYW/Ub6/RXjILieIBb6T03+0gfR/xGnbyXzV2yhpopOrmXsRnbNCH4Hc3OvGyX20AxeENjD7UadDcPIbyzKCCF1vf7B/Yd4aXYkGjtRK4d7mmnZTHd6WaRGK+/YGSpBlQMb/uUix6FZ0tWw/1ye343ZH3+aB4dMGIzFLEBfTS83nanzXEWjTnnveWXU5/H+Or+vr0oFlmbVDh7lqG36IMLEJGljjowkswaQ1nRcqT/DqXuivSCOt3jtynzFZUQCPJnjuEWzfcF3NPjNOdDCXVnlpo= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: e94b05e5-2f94-4296-53b5-08dcee1f9542 X-MS-Exchange-CrossTenant-AuthSource: DS0PR10MB7933.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Oct 2024 20:17:39.6300 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: yOz7DkEoHi7LBnxfu4T8e+Vqglrx1HyoWVEILtp2SteENFfgweUANKH85OVfcW7NaRaXEyAJQyxCqctMyss4+Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA0PR10MB7579 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1051,Hydra:6.0.680,FMLib:17.12.62.30 definitions=2024-10-16_16,2024-10-16_01,2024-09-30_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 malwarescore=0 adultscore=0 bulkscore=0 spamscore=0 mlxlogscore=999 phishscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2409260000 definitions=main-2410160128 X-Proofpoint-ORIG-GUID: sCl0bjDB6H6qpZOU78KTiYjeOtPelN3o X-Proofpoint-GUID: sCl0bjDB6H6qpZOU78KTiYjeOtPelN3o X-Rspamd-Queue-Id: 3653A140008 X-Stat-Signature: bzhidi8m6oiksk6t5ww6y1bj9e9wce85 X-Rspamd-Server: rspam09 X-Rspam-User: X-HE-Tag: 1729109873-313783 X-HE-Meta: U2FsdGVkX1/9TaS1u4l+5289TqbBzE6IgG7JtSuyuzNLZVNP9hHvS2tTNSsILGLf9Ruk046dWIIVJgY0x2bETISuTUxO9dZEvgyUwUeSyP2Js6WQlSmpD61FODL6f+GqQte4lI4U1O0VFpxj1W5nrz7qCse82r1uOsl/nR/irntgVgD0A5CPEamuem656ADvTx+0h9Qg3/jphu2SsZ2nQ/kJFwR0nlW9b4LE5g2y6f9UKxUJhFePUJb7E+mmpBcgLeg7a6eRI9CZAWqOh+7ivKq6UpeOVvLZX8coOXhFdLx+x/8A/hqVW3c5WLQuo9+xeXqSJ9kyzL60AcVrh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xGnCJFapfnCkJKyyP8Sy4jAHeH6YAhrMHCdhpWVDh/tUt+A/MSzUonHI/hItib4s8dlGIEHV4PR1wE+koTbKNq8GCgjA81WXHxmFwWa36JBnHSjCEXmHVOqrq8Ouhims1vCmAKo9VRBOOUXwQSBuoiK6k/5z+8lxN81h8agx7zMQG58PyAVGDXXmsdDQWmD0Owpfhfp0wf13cm2jOTyYP4abwctCLqRo7T43wzujpHe8tQGyCTYDnpDxZp5uYZ X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: From: "Liam R. Howlett" vma_to_resize() is used in two locations to find and validate the vma for the mremap location. One of the two locations already has the vma, which is then re-found to validate the same vma. This code can be simplified by moving the vma_lookup() from vma_to_resize() to mremap_to() and changing the return type to an int error. Since the function now just validates the vma, the function is renamed to mremap_vma_check() to better reflect what it is doing. Signed-off-by: Liam R. Howlett --- mm/mremap.c | 39 +++++++++++++++++++-------------------- 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/mm/mremap.c b/mm/mremap.c index 5917feafe8cc..648c29f568af 100644 --- a/mm/mremap.c +++ b/mm/mremap.c @@ -826,17 +826,12 @@ static unsigned long move_vma(struct vm_area_struct *vma, return new_addr; } -static struct vm_area_struct *vma_to_resize(unsigned long addr, +static int mremap_vma_check(struct vm_area_struct *vma, unsigned long addr, unsigned long old_len, unsigned long new_len, unsigned long flags) { struct mm_struct *mm = current->mm; - struct vm_area_struct *vma; unsigned long pgoff; - vma = vma_lookup(mm, addr); - if (!vma) - return ERR_PTR(-EFAULT); - /* * !old_len is a special case where an attempt is made to 'duplicate' * a mapping. This makes no sense for private mappings as it will @@ -847,37 +842,37 @@ static struct vm_area_struct *vma_to_resize(unsigned long addr, */ if (!old_len && !(vma->vm_flags & (VM_SHARED | VM_MAYSHARE))) { pr_warn_once("%s (%d): attempted to duplicate a private mapping with mremap. This is not supported.\n", current->comm, current->pid); - return ERR_PTR(-EINVAL); + return -EINVAL; } if ((flags & MREMAP_DONTUNMAP) && (vma->vm_flags & (VM_DONTEXPAND | VM_PFNMAP))) - return ERR_PTR(-EINVAL); + return -EINVAL; /* We can't remap across vm area boundaries */ if (old_len > vma->vm_end - addr) - return ERR_PTR(-EFAULT); + return -EFAULT; if (new_len == old_len) - return vma; + return 0; /* Need to be careful about a growing mapping */ pgoff = (addr - vma->vm_start) >> PAGE_SHIFT; pgoff += vma->vm_pgoff; if (pgoff + (new_len >> PAGE_SHIFT) < pgoff) - return ERR_PTR(-EINVAL); + return -EINVAL; if (vma->vm_flags & (VM_DONTEXPAND | VM_PFNMAP)) - return ERR_PTR(-EFAULT); + return -EFAULT; if (!mlock_future_ok(mm, vma->vm_flags, new_len - old_len)) - return ERR_PTR(-EAGAIN); + return -EAGAIN; if (!may_expand_vm(mm, vma->vm_flags, (new_len - old_len) >> PAGE_SHIFT)) - return ERR_PTR(-ENOMEM); + return -ENOMEM; - return vma; + return 0; } static unsigned long mremap_to(unsigned long addr, unsigned long old_len, @@ -936,7 +931,13 @@ static unsigned long mremap_to(unsigned long addr, unsigned long old_len, old_len = new_len; } - vma = vma_to_resize(addr, old_len, new_len, flags); + vma = vma_lookup(mm, addr); + if (!vma) { + ret = -EFAULT; + goto out; + } + + mremap_vma_check(vma, addr, old_len, new_len, flags); if (IS_ERR(vma)) { ret = PTR_ERR(vma); goto out; @@ -1114,11 +1115,9 @@ SYSCALL_DEFINE5(mremap, unsigned long, addr, unsigned long, old_len, /* * Ok, we need to grow.. */ - vma = vma_to_resize(addr, old_len, new_len, flags); - if (IS_ERR(vma)) { - ret = PTR_ERR(vma); + ret = mremap_vma_check(vma, addr, old_len, new_len, flags); + if (ret) goto out; - } /* old_len exactly to the end of the area.. */ From patchwork Wed Oct 16 20:17:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Liam R. Howlett" X-Patchwork-Id: 13838874 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3BD52D2A559 for ; Wed, 16 Oct 2024 20:18:04 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id AB3CF6B008C; Wed, 16 Oct 2024 16:18:03 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A3C246B0089; Wed, 16 Oct 2024 16:18:03 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 865CB6B008A; Wed, 16 Oct 2024 16:18:03 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 6663E6B0083 for ; Wed, 16 Oct 2024 16:18:03 -0400 (EDT) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 35610C0840 for ; Wed, 16 Oct 2024 20:17:52 +0000 (UTC) X-FDA: 82680576594.22.522F21C Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by imf30.hostedemail.com (Postfix) with ESMTP id DB99280008 for ; Wed, 16 Oct 2024 20:17:42 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=YGvzQ+Qj; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=Boo0BOIU; spf=pass (imf30.hostedemail.com: domain of liam.howlett@oracle.com designates 205.220.177.32 as permitted sender) smtp.mailfrom=liam.howlett@oracle.com; dmarc=pass (policy=reject) header.from=oracle.com; arc=pass ("microsoft.com:s=arcselector10001:i=1") ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1729109805; a=rsa-sha256; cv=pass; b=OsKoPPc+MpUioiWIlcd+BXaKF+ahbQKsQxLLSJRMdyPtVW3vA+uqqCay1j62cLyMFBIjsl xaAf9dzPAuicigETRS4lc4Q6YVDz6M/VU46ACbhmsPROJpD+eGw3pb3IWYji9NyYgltLTP RKcOtbB8FNFffw2Ddmk4A4ETLzav8bo= ARC-Authentication-Results: i=2; imf30.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=YGvzQ+Qj; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=Boo0BOIU; spf=pass (imf30.hostedemail.com: domain of liam.howlett@oracle.com designates 205.220.177.32 as permitted sender) smtp.mailfrom=liam.howlett@oracle.com; dmarc=pass (policy=reject) header.from=oracle.com; arc=pass ("microsoft.com:s=arcselector10001:i=1") ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1729109805; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=l3FXzpj5Oxzaq/uDBOwGSH/4JCCCag4pwr8pw0P2YRg=; b=XatKhf5XciYg5DZvKaTr+0ADy1oRML44EebbDcd99+ExW8uUCEWu5s0mI2gvOiR3Gh92ro NIRaxElefvQUzcBZYXZ63XMN+D/rhCpUOtEQedzyErOtJ+cuMTsKMoyQDYSTzake3cpDyJ v+xiF8QeqRn0/SlDXw+d5Ua2wGiZG6I= Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 49GHtfTB027341; Wed, 16 Oct 2024 20:17:44 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s= corp-2023-11-20; bh=l3FXzpj5Oxzaq/uDBOwGSH/4JCCCag4pwr8pw0P2YRg=; b= YGvzQ+QjaYhVP6gOYCI4hjPpylG93N2bIT0KaNNxr3/P8wohZzroNAFTwxSHW4mY 1ce+SR2ZioIER7vV7AVd4qccrGXC6/7469dOe213bEv0jZAsCi1mNNC/VITNjwJl MqvRGSaOXLtZ6KVvsH9OQwHYgI71VUc85m0xg3HhT+CaVX/pxoKUEpSWNh6oRke6 +SmAklVXexJppAR6P2iopqKKF4K+PLwBPh+WgG1coMa53CL/foxYMn6YWF+uq5x4 /SvMxU5c2OgskRrk37NyyBvauC5AfdhmfZ0kHlDOjyJcET7/A7zmhd8n14Cjnkwo WHGH1hPx0Td7lSKkTnXR0A== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 427gqt4snw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 16 Oct 2024 20:17:44 +0000 (GMT) Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 49GJQOOv027123; Wed, 16 Oct 2024 20:17:43 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2042.outbound.protection.outlook.com [104.47.70.42]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 427fjfwk05-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 16 Oct 2024 20:17:43 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=ePcuh1GPiDAXISjLGRWYrD8B6UVMGoRYwBUt8cL0zCcGMbdphib11J6bVdZOGFU5aomrR3HOq4grLXAbvaQ85/I9U+9ELhd/QKVKaF+xEtGuuHyXwF28FkTx2th+OgOB/GWjLFTYgWf8ojvzNYi0HUm7eLIJwdgpCNxKRY187+pw+nVtrVaSsdNd007RL7pRjkQDMW9WtseV+9zdnseHzipFdaXLrXq71KmOdVWHRwMIEgL/ZbrTqL55zETUaY12Brc7blGOqbfzC5ck8Zeaj9WCvSkJ3QEcXbvABLHxZDgSyPva1FwD0t89lB5c84QTNrhtbEocGQVY2X7uVSyyLQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=l3FXzpj5Oxzaq/uDBOwGSH/4JCCCag4pwr8pw0P2YRg=; b=zVZUvjqOnfic66nHNeIpnFk3grjVay3OTlDvvNxQGKGvBqRQD89IttVDGOBVFpy2BQLzFSwf+KXbH24CcagJM8L/1eR5SPbCe7BgciYOCCwBfbe0/sKdXPFsjdioLTSS8ZCU4qdmLqEWya0Z92k+mkRNMeFLdZwyjcRytIB4qjPlTOG1K5EbRnalCI5D1nAJ1/vyHKYGCHDWXqbGLz8em0az1Ev4bSD4/iwgp5W/X4MJIOnEFg8d3D3RKTUI9VLeRN9VFJd4Zfiu37HgswHPELd+jWoMVboKuCrL16qIp5Yn7Jba9NfAs/OcoSsARTg44KMfGAWsoJYMJPUoJNV65A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=l3FXzpj5Oxzaq/uDBOwGSH/4JCCCag4pwr8pw0P2YRg=; b=Boo0BOIUEP5edjKt/OydlNtMvYckk/ro6868BsDwcj7YUfBPIoZCOu7AJ574utZ1hthbeR5rNJ7H3XYat4Y8WxOR8NfnxsomkDVpV2TGcmzo3izz4cvD4H4Djn84en0Vhpn/D7GoQd9u7yBXphFFCWVMdjHuE7oNyOqf8xsEd4k= Received: from DS0PR10MB7933.namprd10.prod.outlook.com (2603:10b6:8:1b8::15) by IA0PR10MB7579.namprd10.prod.outlook.com (2603:10b6:208:493::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.18; Wed, 16 Oct 2024 20:17:41 +0000 Received: from DS0PR10MB7933.namprd10.prod.outlook.com ([fe80::2561:85b0:ae8f:9490]) by DS0PR10MB7933.namprd10.prod.outlook.com ([fe80::2561:85b0:ae8f:9490%7]) with mapi id 15.20.8069.016; Wed, 16 Oct 2024 20:17:41 +0000 From: "Liam R. Howlett" To: Andrew Morton Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Lorenzo Stoakes , Jann Horn , David Hildenbrand , Qi Zheng , Kefeng Wang , Jeff Xu , Pedro Falcato , "Liam R. Howlett" Subject: [PATCH 2/2] mm/mremap: Remove goto from mremap_to() Date: Wed, 16 Oct 2024 16:17:18 -0400 Message-ID: <20241016201719.2449143-3-Liam.Howlett@oracle.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241016201719.2449143-1-Liam.Howlett@oracle.com> References: <20241016201719.2449143-1-Liam.Howlett@oracle.com> X-ClientProxiedBy: YTBP288CA0006.CANP288.PROD.OUTLOOK.COM (2603:10b6:b01:14::19) To DS0PR10MB7933.namprd10.prod.outlook.com (2603:10b6:8:1b8::15) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS0PR10MB7933:EE_|IA0PR10MB7579:EE_ X-MS-Office365-Filtering-Correlation-Id: b0b512ee-24ed-4995-e0f1-08dcee1f9652 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|366016|376014; X-Microsoft-Antispam-Message-Info: H/5ooc7ENFAPaGsVkUHYMhkXRAe3zuW6H/76Le9wwPcWBcZA0eGup7uTjpp+tVWTpHWrOvsq3YSVhOKW5o6gssjQs9wE3Fx3wp2MHUjawBl1YGUwZcE4D+csUnmj5+PXM0CE6iLal1FyuxGxzIoO49BIbfebQ3grE3EaQ5/JmtxUme+noFFDh8MrbQPUSe/8vGB7XNF3BbV/u9C8PnDvNYMPPzN6Hl2hZbMWpn1ooW68TVdXrg7khjzasGMXc7vnU601Ups+5i6/9ieRgzvvpXs9xdZy3GpbwjCs95hv1JeqZ9xmXtA1fxNXhNyirh1Cxe0vzpGAPF1Qk4PIk+25pgq7T61tksmhIxyNwWakvNvyuhL1leF8sowOLl1TAcncwxqYxVCb8a5lx9zq0qacHnPp0uKcFU+EgtBPhixfhjQTuKAhiB/vwwKK/0MIVODkruIEVkbFwIs4ry/hvKLHplU1gr8TtVcSemd7a0o+9fdxBKdXxNNJvCrfzOFATPcu7VhfugVHrF7lwPOVMcbxLL1K4oQM8lF4nKNh0P1n0R8uPSDGroq+fR5HSsCsNRZPoG7SFUw37p0pcfV7eaNEuTWZSdgGgRbRuHMn2lH5y0eGwsEirby9Hy2lEPF0aJNvpjDk7KJ3W29CGEW5c9zbw73lCruFGieyNY+xrLixqFLUim7CM7ctGQoXvQ9MDpek/fYIY550Zx53/6Z+zpADhg/n3FH3VP7umXT0/AHYFY4UdM8AEQYWvt1VyHs4iXnqlXnZ3Hc99o5NIiCShSYwMeX9RV0f5syq6qC1Pcy1v8CZhdlD1Yg9VPsrtT0tfGcYDLi+tOWUUrIPW/CFZQGihKs2f09GobcBTpUmCjJz9JUp0JbthVbiodefTE3l/xGCufQAtip/EYPa+0+c07BX6LcZEiYyNgpPfdjSScNsMVeO7DmEGRsg3BzghwYTkqcvI/jUfKwQ0MP8h19hZUHKza4UG/BHX3gXQbt8C92bZKWK4HUYS7rfCQDrfF4QuA9HetVwjmRwoPziHO2FwId/gVql5qDEfQ3ouFJaOwRzE+KirtNdZzD1Smwu1IrogspAyVERcw9JyE9DqU0TzUTnEzg2AL1v4IpuaxdT3A8kObIe0UDyCYoinkOYhJ4BkmwvbfxG2cdgaXKGZnfC04uF25wHxEAyJY4om1GezRLmskEVi1nHqMEVws4ooVP8I9O1O+m7EIEWbr/1v3oRDmN3V2jcpNf2IaS6yHVhG/pVp+Rbyf0ix+fNY5kgl/jRB5TG7ABfX1fJiOcDDXaToUQh/WKhm9yi/ZKR+5SOePyDOuWbyAtAGZPGJFXLm64OdOR2 X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DS0PR10MB7933.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(366016)(376014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: oCq2DE7sdj+r6KqJ3Xzj3nrSe7e/8DeK0eWXSXT9K/m49pKP8WuVuYpmAaI0nBLxvCI+Ys2hK103GrQsqoi/4WpkLnfyitUxm7Ph+j0d5tNmtZTAP/wOOlowImLVF6/bSCEDi+sfzqpJbgE2J29lTF5WEtPp2evp3bBunCrp9QtIl6ilhRcG+TiXdbavmzaOAPiIeKU4uSu6HE6O6rfQlL2O2QXdY3HwZI1rDRIepplBjcV8Qm/FwiIBMA/IYcBPeD/0W6IIr7rqvX7t52SlES5vXIh1a/QwArMXFHFvEW6qjSonvZl65NXuzL55GN5E9v3uePazJ/RHF3vxulHkkrZhxsf3aF9h9ZNAxUMm5DphnZLODrc1XOLpaw3CpCUs8usKaOz2VxkCRXW7b4faRVsYN9WfCMLVJ1zeij8wK3tKHGT7zZvx+G1KcTvIKMCKrgkvE7WdRC8J34sSoa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N+1XJFpGgM7K4nzrS2rlW1S4xmQQcDpPrMFDWQioRiGhTob7n2ocv2yHM8n5vFGD7dltUyCz6szQ== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: e4vjIhshNh/Co8yQir3VEnhqoPFFvxx/GQj9chvJza/OOC7+sSgym4iO1YVNCIxgq/RaVtw6UyDC60jbBD6a1Z31h7jjEqno0ZboH13rLl5s6ouFMtyPQnwHHvcBQsliswq3k9TJNQUg9+syYrc9MRTJ/+nuytDHrz+UFhbTVNaSGd0eAaQ4378YVzfL2KsNMFAVjUtpjtZh6oeQ7pUW82yQpZi8lMGuPZj6S6XzloNc6V0+PvvteSBCAfB7zYH0AXm6NhlfZnEhunygMqcP9NPoCjwlERsUIxATo1Hlb2n3WQF5z+bHg45PIjGlesVxn8GdHY4zHL7lFfAvrMilKCjXzdfgrcuwSkOI5jayWlERtodBPF6HavblwiOiKOZAkqboMOMVp/TC/fUaexvkyls4iQBdwf+l9zA+H8ZdIPdgXPqQyK3QoQrE28lE4b7xH9ra2rE38UNQ5TK32qpvGNiRnd60nqWgxsMugQHhaJxDNOiTHH3nNyRLNQDpWqyktIEgFzJkpfIMjXdNtM8dwRgAtaTTn7KfgrCaa5IB3MFifS9HwiTS8+TSvk4OLfm7k0iW3fo7VQxyA+nERtKYQlp3gdNN+GjBG9LVKgemWWg= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: b0b512ee-24ed-4995-e0f1-08dcee1f9652 X-MS-Exchange-CrossTenant-AuthSource: DS0PR10MB7933.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Oct 2024 20:17:41.4040 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: A/rTvBxze49jguMUuZ9AWCP87yAQMKh+hKnvBrfOxPN9bQCiSgzDxeiW05rwFyZP8LmsTEN5QzQPiLCzyprmsQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA0PR10MB7579 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1051,Hydra:6.0.680,FMLib:17.12.62.30 definitions=2024-10-16_16,2024-10-16_01,2024-09-30_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 adultscore=0 spamscore=0 malwarescore=0 bulkscore=0 suspectscore=0 mlxscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2409260000 definitions=main-2410160128 X-Proofpoint-GUID: WEE5SXNHBXo73NwsSxnWiw2GK66SggP- X-Proofpoint-ORIG-GUID: WEE5SXNHBXo73NwsSxnWiw2GK66SggP- X-Stat-Signature: i3oea17se3t4z71qxb4pczgmo4ppuagi X-Rspamd-Queue-Id: DB99280008 X-Rspam-User: X-Rspamd-Server: rspam10 X-HE-Tag: 1729109862-556111 X-HE-Meta: U2FsdGVkX188/+rGTkltIleGs4530iFDuTcsZoKlCLHjFCOdbxNkUaYb4A3kme8xVTv+t+/gkEe8mtYt+cjZl3+DwuyQpg3Q0xQUQx91i6sAsRgd6EZnTcy5gEhtyjCDkGf/fW0gGwU7hchmp6Hethbsz8LU8ipGdK/VWWLQJX9Qg68R8i5QrYytCnQw0VuNgD51+d/MTT7vEEEwrNYQEwtm9EZ3lHfRq8+uSp/EijGfQrcZrPHQ0dtA59f6fJ9ekQND2ek8EuQgrfXDhr71iSlV7/uVd4rnnBcDsmJHEWU8s6JPe0vh7UrIRZpYHruGVoE6BaM2x3RGGvv8kL/v0WDeyBGpK3PQij/yo71GGRS6ypTqzF1DqIYEt6NHPvOG/ToW8u2XxiKZPkUNY5zbJagnAhtIc2Sk1BndIZ5P9Ziy7EutYzFzP0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BemhanWSJhAawUvlCBRFOehJsDWyF8DvLsRde5ovxzvpMf1UWlFuMPOAT/BDOAONgxh4/t6yMGzAbHHRYoLeKxYzjMVbeeNkNLPFGb+o= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: From: "Liam R. Howlett" mremap_to() has a goto label at the end that doesn't unwind anything. Removing the label makes the code cleaner. Signed-off-by: Liam R. Howlett --- mm/mremap.c | 38 +++++++++++++++----------------------- 1 file changed, 15 insertions(+), 23 deletions(-) diff --git a/mm/mremap.c b/mm/mremap.c index 648c29f568af..5a1eb3da730d 100644 --- a/mm/mremap.c +++ b/mm/mremap.c @@ -883,18 +883,18 @@ static unsigned long mremap_to(unsigned long addr, unsigned long old_len, { struct mm_struct *mm = current->mm; struct vm_area_struct *vma; - unsigned long ret = -EINVAL; + unsigned long ret; unsigned long map_flags = 0; if (offset_in_page(new_addr)) - goto out; + return -EINVAL; if (new_len > TASK_SIZE || new_addr > TASK_SIZE - new_len) - goto out; + return -EINVAL; /* Ensure the old/new locations do not overlap */ if (addr + old_len > new_addr && new_addr + new_len > addr) - goto out; + return -EINVAL; /* * move_vma() need us to stay 4 maps below the threshold, otherwise @@ -921,33 +921,28 @@ static unsigned long mremap_to(unsigned long addr, unsigned long old_len, */ ret = do_munmap(mm, new_addr, new_len, uf_unmap_early); if (ret) - goto out; + return ret; } if (old_len > new_len) { ret = do_munmap(mm, addr+new_len, old_len - new_len, uf_unmap); if (ret) - goto out; + return ret; old_len = new_len; } vma = vma_lookup(mm, addr); - if (!vma) { - ret = -EFAULT; - goto out; - } + if (!vma) + return -EFAULT; - mremap_vma_check(vma, addr, old_len, new_len, flags); - if (IS_ERR(vma)) { - ret = PTR_ERR(vma); - goto out; - } + ret = mremap_vma_check(vma, addr, old_len, new_len, flags); + if (ret) + return ret; /* MREMAP_DONTUNMAP expands by old_len since old_len == new_len */ if (flags & MREMAP_DONTUNMAP && !may_expand_vm(mm, vma->vm_flags, old_len >> PAGE_SHIFT)) { - ret = -ENOMEM; - goto out; + return -ENOMEM; } if (flags & MREMAP_FIXED) @@ -960,17 +955,14 @@ static unsigned long mremap_to(unsigned long addr, unsigned long old_len, ((addr - vma->vm_start) >> PAGE_SHIFT), map_flags); if (IS_ERR_VALUE(ret)) - goto out; + return ret; /* We got a new mapping */ if (!(flags & MREMAP_FIXED)) new_addr = ret; - ret = move_vma(vma, addr, old_len, new_len, new_addr, locked, flags, uf, - uf_unmap); - -out: - return ret; + return move_vma(vma, addr, old_len, new_len, new_addr, locked, flags, + uf, uf_unmap); } static int vma_expandable(struct vm_area_struct *vma, unsigned long delta)