Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp1119772ybh; Sat, 7 Mar 2020 19:28:45 -0800 (PST) X-Google-Smtp-Source: ADFU+vs2FhgT+eiBn6ywjOLivIwLlN+4hrOdvYWrKNxPoIzQvkR8C/J6+TSlPGHMUZXNw9dmshUZ X-Received: by 2002:a05:6808:b17:: with SMTP id s23mr569376oij.166.1583638124941; Sat, 07 Mar 2020 19:28:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583638124; cv=none; d=google.com; s=arc-20160816; b=bcTI7zyWbA4aNGVdBUNaVAn4pHtCjzDJ/cjjeONEZfV+/Ybi3925SCR5OOpDRgLH4M EPvRKZGNYZPV9kZOeZfR5Ddalbsar8aQcEW/drpMUxffDCigsI0vD/53+i2sLAwpWekm 5w0CofTr82rbLxqplevahROB7jaSx66eVf8+1Xc8E7k8aJdrQwWA/cp94eke0M8+7UYo ZI+Ww0M5DMt8LRKQqbQE4/NgAvAoR/X57UTsCm1RkDNWjAyhf8RlU3d2i7FDEBP/LLmw NvZXKyr6XMNr9dheBz0whfDcUV/W54wBpCEFibq3B/xcp3aehqp5JW2Vw9UNk32S6am5 Y6GA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=v4zQeL4Z1KuJi92pqEyQSeMqqjfyeiWCsrFrYVOFg4U=; b=x9kVKYSFyld5uQIsRSn8Ap/S/s79UI7H3siJSixsPjGusZQ7f6AwiEFeJrv3XGMe1C 8D+V7AkdYSFm/m5trZuhqvzQdNYe98PfTTgLQNL6jwSrFdpjSDMaUrU06C1oIYSPxmHz b/8jT9cD1j/6vIPCCSTRnDNQZTJAixlD3dHRCjcT/C4K56/WUF8XjtIsvO7p57nsyX4P 8N5BqvnXKpE0RIqeGNVeZ0xipgL7c9bzMhtS29gusP0dRfUpeg/hy2RD8dbtiVIw70lj XkakXBcBFcZtFLElFWXeOIDw9EMFAjlocnKsSH/KXM21/bMnqvR92F8+8XatyOCtTjKy Y8Zw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="o/7AWOvS"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k24si53199otf.213.2020.03.07.19.28.33; Sat, 07 Mar 2020 19:28:44 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="o/7AWOvS"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726284AbgCHD15 (ORCPT + 99 others); Sat, 7 Mar 2020 22:27:57 -0500 Received: from mail.kernel.org ([198.145.29.99]:38802 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726138AbgCHD14 (ORCPT ); Sat, 7 Mar 2020 22:27:56 -0500 Received: from sol.hsd1.ca.comcast.net (c-107-3-166-239.hsd1.ca.comcast.net [107.3.166.239]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E0D712070A; Sun, 8 Mar 2020 03:27:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1583638076; bh=5TXqc/wHOgpq3fBa+jiwOk9beKszHKLHMpxvbc3OoD4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=o/7AWOvSLlzDiPa4iOe5/OS5yMWyBEL6gL8SJdyu/qF4RMsRlhR7g8vBPmfuZ9Myf vVGRZcalA0mD5h9JX08vA3aGaDafGGqgUtkuiGB0k2otUTs/VQVbaDT5CypS/IgoPo mrlwjEkI6jCzkC4HPYw9cwI3BzvjqZHgbiJnVfus= From: Eric Biggers To: linux-pm@vger.kernel.org, Len Brown , Pavel Machek , "Rafael J . Wysocki" Cc: glider@google.com, linux-kernel@vger.kernel.org, syzbot+af962bf9e7e27bccd025@syzkaller.appspotmail.com Subject: [PATCH] PM / hibernate: Remove unnecessary compat ioctl overrides Date: Sat, 7 Mar 2020 19:27:01 -0800 Message-Id: <20200308032701.998434-1-ebiggers@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200308032434.GX15444@sol.localdomain> References: <20200308032434.GX15444@sol.localdomain> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Eric Biggers Since the SNAPSHOT_GET_IMAGE_SIZE, SNAPSHOT_AVAIL_SWAP_SIZE, and SNAPSHOT_ALLOC_SWAP_PAGE ioctls produce an loff_t result, and loff_t is always 64-bit even in the compat case, there's no reason to have the special compat handling for these ioctls. Just remove this unneeded code so that these ioctls call into snapshot_ioctl() directly, doing just the compat_ptr() conversion on the argument. (This unnecessary code was also causing a KMSAN false positive.) Signed-off-by: Eric Biggers --- kernel/power/user.c | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/kernel/power/user.c b/kernel/power/user.c index 77438954cc2b..58ed9478787f 100644 --- a/kernel/power/user.c +++ b/kernel/power/user.c @@ -409,21 +409,7 @@ snapshot_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg) switch (cmd) { case SNAPSHOT_GET_IMAGE_SIZE: case SNAPSHOT_AVAIL_SWAP_SIZE: - case SNAPSHOT_ALLOC_SWAP_PAGE: { - compat_loff_t __user *uoffset = compat_ptr(arg); - loff_t offset; - mm_segment_t old_fs; - int err; - - old_fs = get_fs(); - set_fs(KERNEL_DS); - err = snapshot_ioctl(file, cmd, (unsigned long) &offset); - set_fs(old_fs); - if (!err && put_user(offset, uoffset)) - err = -EFAULT; - return err; - } - + case SNAPSHOT_ALLOC_SWAP_PAGE: case SNAPSHOT_CREATE_IMAGE: return snapshot_ioctl(file, cmd, (unsigned long) compat_ptr(arg)); -- 2.25.1