]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
cifs: Fix printing Status code into dmesg
authorPali Rohár <pali@kernel.org>
Thu, 26 Dec 2024 13:27:16 +0000 (14:27 +0100)
committerSteve French <stfrench@microsoft.com>
Mon, 20 Jan 2025 01:46:42 +0000 (19:46 -0600)
NT Status code is 32-bit number, so for comparing two NT Status codes is
needed to check all 32 bits, and not just low 24 bits.

Before this change kernel printed message:
"Status code returned 0x8000002d NT_STATUS_NOT_COMMITTED"

It was incorrect as because NT_STATUS_NOT_COMMITTED is defined as
0xC000002d and 0x8000002d has defined name NT_STATUS_STOPPED_ON_SYMLINK.

With this change kernel prints message:
"Status code returned 0x8000002d NT_STATUS_STOPPED_ON_SYMLINK"

Signed-off-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/smb/client/netmisc.c

index 2a8d71221e5e71d03ca97a7097a8ed5e876fec28..17b3e21ea8689ae7c50dbb630e7d6d35d5a5987e 100644 (file)
@@ -775,10 +775,10 @@ cifs_print_status(__u32 status_code)
        int idx = 0;
 
        while (nt_errs[idx].nt_errstr != NULL) {
-               if (((nt_errs[idx].nt_errcode) & 0xFFFFFF) ==
-                   (status_code & 0xFFFFFF)) {
+               if (nt_errs[idx].nt_errcode == status_code) {
                        pr_notice("Status code returned 0x%08x %s\n",
                                  status_code, nt_errs[idx].nt_errstr);
+                       return;
                }
                idx++;
        }