Received: by 2002:a05:6a10:3150:0:0:0:0 with SMTP id m16csp3017509pxc; Tue, 12 Apr 2022 11:12:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwkwSS+dU3clsMXjpp8ozcWK8c1vqQt1b3W1SSjMj4OAFwofJbkaLDz7dkgDNeu11aqFT8t X-Received: by 2002:a17:902:e84f:b0:158:7192:8686 with SMTP id t15-20020a170902e84f00b0015871928686mr9179855plg.87.1649787121853; Tue, 12 Apr 2022 11:12:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649787121; cv=none; d=google.com; s=arc-20160816; b=uj/ugZcad3tw3tGfy/TMyA/I8V/ts5SdSvHg42zxjtgAwnIw1UheyCZ1CSRSfppzyg fs5yNpoEEoLytt/tGv9G9DR7K1WFJ+enVHHGor9yeDc65eSpPCtqoIQUIXUM29NCL9k3 TOl7Cbm0o/0CKLs94ZtMSJem9xYwumRl7hiwdxUEcRKXjqPuIAHOLrlD0FfAiZfbmuJ3 mA8GPz+yt+n1CPHvaz+oJa69PMMWpTaMLeeGJ3gA5AbTUosrfseXp06Zo/3JLZOS7W6n RVNgQIhy/DPN5CI7omQQxgWZPA/uN4Tq6oSP620FqKTQZ/O3WpxG935w//AkDw9EMKyX fLhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:message-id:subject:cc:to :from:date:dkim-signature; bh=D+XJaf7h6+3Eoi7jpfHr9ZIJMx44xBPQcMP6evn0mvM=; b=KzMwseICRH5dhxWDO16fz9XUiEM+f5yd+9fIdSzpTAKuzFw1RSO55CWRuhI+loI38E Cve8ESuImXTH952ge1L7S+SyuExuuhMbVpfuWdnDWj22y/sTZ/BsZq1KqMZPx0dGYXho Ww7mOwJL4RcLLQTbweYo0B1CdFMiiAPOY+5hFFnUE+tn0lg65kR8ZMHV8J75y7A9q8hV HaTZKbvpRfv8yOBuzEfoZcgcIAAcAPLG72BJSjwhzkSwIlB9fpfcpZRuwty84ngh5yC9 9AiYSxA7r4Ms9//x1/ItYeHMx1VkNYfZZFzHY2sCz587FewXuJR+wJ65H+MNxem/geTu trzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=C6axpMw1; 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=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 25-20020a631459000000b0039cef731115si3423342pgu.268.2022.04.12.11.11.36; Tue, 12 Apr 2022 11:12:01 -0700 (PDT) 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=@redhat.com header.s=mimecast20190719 header.b=C6axpMw1; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347308AbiDKOpy (ORCPT + 99 others); Mon, 11 Apr 2022 10:45:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34748 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230368AbiDKOpx (ORCPT ); Mon, 11 Apr 2022 10:45:53 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 2EA4C13CC8 for ; Mon, 11 Apr 2022 07:43:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1649688218; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type; bh=D+XJaf7h6+3Eoi7jpfHr9ZIJMx44xBPQcMP6evn0mvM=; b=C6axpMw1zaIDwe4b179brdq4H6MliRFOgoihXSDzuYT5968vnTqhXO56JurO1om36ZbbyC uZR/Zf5R72zXvmjidhvKcjjslygFeNLjJFfk7jJB8crFYIETS7z488ZkqAqZ/ZBWTLQRII FR9DOCcML0b2iX2A18MYKtZh8wUdZvI= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-662-lfMXun7DO--7UttZUDDmag-1; Mon, 11 Apr 2022 10:43:33 -0400 X-MC-Unique: lfMXun7DO--7UttZUDDmag-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 7F95183396D; Mon, 11 Apr 2022 14:43:33 +0000 (UTC) Received: from file01.intranet.prod.int.rdu2.redhat.com (file01.intranet.prod.int.rdu2.redhat.com [10.11.5.7]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7A16A40FF407; Mon, 11 Apr 2022 14:43:33 +0000 (UTC) Received: from file01.intranet.prod.int.rdu2.redhat.com (localhost [127.0.0.1]) by file01.intranet.prod.int.rdu2.redhat.com (8.14.4/8.14.4) with ESMTP id 23BEhXra022612; Mon, 11 Apr 2022 10:43:33 -0400 Received: from localhost (mpatocka@localhost) by file01.intranet.prod.int.rdu2.redhat.com (8.14.4/8.14.4/Submit) with ESMTP id 23BEhXeM022608; Mon, 11 Apr 2022 10:43:33 -0400 X-Authentication-Warning: file01.intranet.prod.int.rdu2.redhat.com: mpatocka owned process doing -bs Date: Mon, 11 Apr 2022 10:43:33 -0400 (EDT) From: Mikulas Patocka X-X-Sender: mpatocka@file01.intranet.prod.int.rdu2.redhat.com To: Linus Torvalds , Alexander Viro cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] stat: don't fail if the major number is >= 256 Message-ID: User-Agent: Alpine 2.02 (LRH 1266 2009-07-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Scanned-By: MIMEDefang 2.84 on 10.11.54.2 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE 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 If you run a program compiled with OpenWatcom for Linux on a filesystem on NVMe, all "stat" syscalls fail with -EOVERFLOW. The reason is that the NVMe driver allocates a device with the major number 259 and it doesn't pass the "old_valid_dev" test. This patch removes the tests - it's better to wrap around than to return an error. (note that cp_old_stat also doesn't report an error and wraps the number around) Signed-off-by: Mikulas Patocka --- fs/stat.c | 6 ------ 1 file changed, 6 deletions(-) Index: linux-5.17.2/fs/stat.c =================================================================== --- linux-5.17.2.orig/fs/stat.c 2022-04-10 21:39:27.000000000 +0200 +++ linux-5.17.2/fs/stat.c 2022-04-10 21:42:43.000000000 +0200 @@ -334,7 +334,6 @@ SYSCALL_DEFINE2(fstat, unsigned int, fd, # define choose_32_64(a,b) b #endif -#define valid_dev(x) choose_32_64(old_valid_dev(x),true) #define encode_dev(x) choose_32_64(old_encode_dev,new_encode_dev)(x) #ifndef INIT_STRUCT_STAT_PADDING @@ -345,8 +344,6 @@ static int cp_new_stat(struct kstat *sta { struct stat tmp; - if (!valid_dev(stat->dev) || !valid_dev(stat->rdev)) - return -EOVERFLOW; #if BITS_PER_LONG == 32 if (stat->size > MAX_NON_LFS) return -EOVERFLOW; @@ -644,9 +641,6 @@ static int cp_compat_stat(struct kstat * { struct compat_stat tmp; - if (!old_valid_dev(stat->dev) || !old_valid_dev(stat->rdev)) - return -EOVERFLOW; - memset(&tmp, 0, sizeof(tmp)); tmp.st_dev = old_encode_dev(stat->dev); tmp.st_ino = stat->ino;