From d4743388f6ecb298369c6c53f85ecf290d608032 Mon Sep 17 00:00:00 2001 From: zhangyaqi Date: Sun, 12 Oct 2025 03:48:18 +0800 Subject: [PATCH] fix compiler warnings in mount.cifs (cherry picked from commit 45484e3f5b1dea56dfe69ff63da345c937a1f749) --- ...-fix-compiler-warnings-in-mount.cifs.patch | 106 ++++++++++++++++++ cifs-utils.spec | 6 +- 2 files changed, 111 insertions(+), 1 deletion(-) create mode 100644 0005-fix-compiler-warnings-in-mount.cifs.patch diff --git a/0005-fix-compiler-warnings-in-mount.cifs.patch b/0005-fix-compiler-warnings-in-mount.cifs.patch new file mode 100644 index 0000000..4cebf7a --- /dev/null +++ b/0005-fix-compiler-warnings-in-mount.cifs.patch @@ -0,0 +1,106 @@ +From 3b398432ced678dac232b27a59ea90b172933b9b Mon Sep 17 00:00:00 2001 +From: Meetakshi Setiya +Date: Fri, 6 Dec 2024 01:58:50 -0500 +Subject: [PATCH] Fix compiler warnings in mount.cifs + +Signed-off-by: Meetakshi Setiya +Signed-off-by: Steve French +Reference:https://git.samba.org/?p=cifs-utils.git;a=patch;h=3b398432ced678dac232b27a59ea90b172933b9b +--- + mount.cifs.c | 38 +++++++++++++++++++++++++++++++------- + 1 file changed, 31 insertions(+), 7 deletions(-) + +diff --git a/mount.cifs.c b/mount.cifs.c +index 2278995..41059ed 100644 +--- a/mount.cifs.c ++++ b/mount.cifs.c +@@ -830,7 +830,7 @@ parse_options(const char *data, struct parsed_mount_info *parsed_info) + * wide +1 for NULL, and +1 for good measure + */ + char txtbuf[22]; +- unsigned long long snapshot; ++ unsigned long long snapshot = 0; + struct tm tm; + + /* make sure we're starting from beginning */ +@@ -1218,7 +1218,11 @@ nocopy: + strlcat(out, ",", MAX_OPTIONS_LEN); + out_len++; + } +- snprintf(out + out_len, word_len + 5, "uid=%s", txtbuf); ++ rc = snprintf(out + out_len, word_len + 5, "uid=%s", txtbuf); ++ if (rc < 0) { ++ fprintf(stderr, "Error in creating mount string\n"); ++ return EX_SYSERR; ++ } + out_len = strlen(out); + } + if (parsed_info->is_krb5 && parsed_info->sudo_uid) { +@@ -1238,7 +1242,11 @@ nocopy: + strlcat(out, ",", MAX_OPTIONS_LEN); + out_len++; + } +- snprintf(out + out_len, word_len + 7, "cruid=%s", txtbuf); ++ rc = snprintf(out + out_len, word_len + 7, "cruid=%s", txtbuf); ++ if (rc < 0) { ++ fprintf(stderr, "Error in creating mount string\n"); ++ return EX_SYSERR; ++ } + out_len = strlen(out); + } + if (got_gid) { +@@ -1254,7 +1262,11 @@ nocopy: + strlcat(out, ",", MAX_OPTIONS_LEN); + out_len++; + } +- snprintf(out + out_len, word_len + 5, "gid=%s", txtbuf); ++ rc = snprintf(out + out_len, word_len + 5, "gid=%s", txtbuf); ++ if (rc < 0) { ++ fprintf(stderr, "Error in creating mount string\n"); ++ return EX_SYSERR; ++ } + out_len = strlen(out); + } + if (got_bkupuid) { +@@ -1270,7 +1282,11 @@ nocopy: + strlcat(out, ",", MAX_OPTIONS_LEN); + out_len++; + } +- snprintf(out + out_len, word_len + 11, "backupuid=%s", txtbuf); ++ rc = snprintf(out + out_len, word_len + 11, "backupuid=%s", txtbuf); ++ if (rc < 0) { ++ fprintf(stderr, "Error in creating mount string\n"); ++ return EX_SYSERR; ++ } + out_len = strlen(out); + } + if (got_bkupgid) { +@@ -1286,7 +1302,11 @@ nocopy: + strlcat(out, ",", MAX_OPTIONS_LEN); + out_len++; + } +- snprintf(out + out_len, word_len + 11, "backupgid=%s", txtbuf); ++ rc = snprintf(out + out_len, word_len + 11, "backupgid=%s", txtbuf); ++ if (rc < 0) { ++ fprintf(stderr, "Error in creating mount string\n"); ++ return EX_SYSERR; ++ } + out_len = strlen(out); + } + if (got_snapshot) { +@@ -1302,7 +1322,11 @@ nocopy: + strlcat(out, ",", MAX_OPTIONS_LEN); + out_len++; + } +- snprintf(out + out_len, word_len + 10, "snapshot=%s", txtbuf); ++ rc = snprintf(out + out_len, word_len + 10, "snapshot=%s", txtbuf); ++ if (rc < 0) { ++ fprintf(stderr, "Error in creating mount string\n"); ++ return EX_SYSERR; ++ } + out_len = strlen(out); + } + +-- +2.43.0 + diff --git a/cifs-utils.spec b/cifs-utils.spec index 9767fc2..e2e8f37 100644 --- a/cifs-utils.spec +++ b/cifs-utils.spec @@ -1,6 +1,6 @@ Name: cifs-utils Version: 6.14 -Release: 4 +Release: 5 Summary: Utilities for doing and managing mounts of the Linux CIFS filesystem License: GPLv3+ URL: http://linux-cifs.samba.org/cifs-utils/ @@ -16,6 +16,7 @@ Patch1: 0001-CVE-2022-27239.patch Patch2: 0002-CVE-2022-29869.patch Patch3: 0003-setcifsacl-fix-comparison-of-actions-reported-by-cov.patch Patch4: 0004-cifs-utils-work-around-missing-krb5_free_string-in-H.patch +Patch5: 0005-fix-compiler-warnings-in-mount.cifs.patch %description The in-kernel CIFS filesystem is generally the preferred method for mounting @@ -80,6 +81,9 @@ install -m 644 contrib/request-key.d/cifs.spnego.conf %{buildroot}%{_sysconfdir} %{_mandir}/man8/* %changelog +* Mon Oct 13 2025 zhangyaqi - 6.14-5 +- backport patch fix compiler warnings in mount.cifs + * Thu Jun 8 2023 volcanodragon - 6.14-4 - Sync some patches -- Gitee