- From ca82a4f2167cf9f5c918676cb8b59ca8e4ae3d4a Mon Sep 17 00:00:00 2001
- From: Dan Shelton <dan.f.shelton@gmail.com>
- Date: Wed, 10 Dec 2025 20:59:01 +0100
- Subject: [PATCH] sys: Fix printf()-style&co format argument warnings
- Fix printf()-style&co format argument warnings.
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- sys/nfs41sys_debug.c | 23 ++++++++++++++++++-----
- sys/nfs41sys_debug.h | 9 +++++++--
- sys/nfs41sys_driver.c | 4 ++--
- sys/nfs41sys_fileinfo.c | 8 ++++----
- sys/nfs41sys_fsctl.c | 2 +-
- sys/nfs41sys_mount.c | 7 ++++---
- sys/nfs41sys_openclose.c | 2 +-
- 7 files changed, 37 insertions(+), 18 deletions(-)
- diff --git a/sys/nfs41sys_debug.c b/sys/nfs41sys_debug.c
- index a8513e9..c127324 100644
- --- a/sys/nfs41sys_debug.c
- +++ b/sys/nfs41sys_debug.c
- @@ -62,7 +62,11 @@
- //#define INCLUDE_TIMESTAMPS
- -ULONG __cdecl DbgP(IN PCCH fmt, ...)
- +#ifdef _MSC_VER
- +ULONG DbgP(_In_z_ _Printf_format_string_ const char *restrict fmt, ...)
- +#else
- +ULONG DbgP(const char *restrict fmt, ...)
- +#endif /* _MSC_VER */
- {
- CHAR msg[512];
- va_list args;
- @@ -100,7 +104,11 @@ ULONG __cdecl DbgP(IN PCCH fmt, ...)
- return 0;
- }
- -ULONG __cdecl print_error(IN PCCH fmt, ...)
- +#ifdef _MSC_VER
- +ULONG print_error(_In_z_ _Printf_format_string_ const char *restrict fmt, ...)
- +#else
- +ULONG print_error(const char *restrict fmt, ...)
- +#endif /* _MSC_VER */
- {
- CHAR msg[512];
- va_list args;
- @@ -342,7 +350,10 @@ void print_file_object(int on, PFILE_OBJECT file)
- DbgP("FsContext 0x%p FsContext2 0x%p\n",
- file->FsContext, file->FsContext2);
- DbgP("DeletePending %d ReadAccess %d WriteAccess %d DeleteAccess %d\n",
- - file->DeletePending, file->WriteAccess, file->DeleteAccess);
- + file->DeletePending,
- + file->ReadAccess,
- + file->WriteAccess,
- + file->DeleteAccess);
- DbgP("SharedRead %d SharedWrite %d SharedDelete %d Flags 0x%x\n",
- file->SharedRead, file->SharedWrite, file->SharedDelete,
- file->Flags);
- @@ -526,7 +537,9 @@ void print_nt_create_params(int on, NT_CREATE_PARAMETERS params)
- (params.ShareAccess & FILE_SHARE_DELETE)?"DELETE":"");
- DbgP("Desired Access: "
- - "0x%x '%s' '%s' '%s' '%s' '%s' '%s' '%s' '%s' '%s' '%s' '%s'\n",
- + "0x%x "
- + "'%s' '%s' '%s' '%s' '%s' '%s' '%s' '%s' '%s' '%s' '%s' '%s' '%s' "
- + "'%s' '%s' '%s' '%s'\n",
- params.DesiredAccess,
- (params.DesiredAccess & FILE_READ_DATA)?"READ":"",
- (params.DesiredAccess & STANDARD_RIGHTS_READ)?"READ_ACL":"",
- @@ -706,7 +719,7 @@ const char *opcode2string(nfs41_opcodes opcode)
- void print_acl_args(
- SECURITY_INFORMATION info)
- {
- - DbgP("Security query: '%s' '%s' '%s'\n",
- + DbgP("Security query: '%s' '%s' '%s' '%s'\n",
- (info & OWNER_SECURITY_INFORMATION)?"OWNER":"",
- (info & GROUP_SECURITY_INFORMATION)?"GROUP":"",
- (info & DACL_SECURITY_INFORMATION)?"DACL":"",
- diff --git a/sys/nfs41sys_debug.h b/sys/nfs41sys_debug.h
- index d9dd4d0..d84bcb1 100644
- --- a/sys/nfs41sys_debug.h
- +++ b/sys/nfs41sys_debug.h
- @@ -28,8 +28,13 @@ typedef enum _nfs41_opcodes nfs41_opcodes;
- #define _DRIVER_NAME_ "NFS4.1 Driver"
- -ULONG __cdecl DbgP(IN PCCH fmt, ...);
- -ULONG __cdecl print_error(IN PCCH fmt, ...);
- +#ifdef _MSC_VER
- +ULONG DbgP(_In_z_ _Printf_format_string_ const char *restrict fmt, ...);
- +ULONG print_error(_In_z_ _Printf_format_string_ const char *restrict fmt, ...);
- +#else
- +ULONG DbgP(const char *restrict fmt, ...);
- +ULONG print_error(const char *restrict fmt, ...);
- +#endif /* _MSC_VER */
- VOID print_fo_all(int on, IN PRX_CONTEXT c);
- VOID print_srv_call(IN PMRX_SRV_CALL p);
- VOID print_net_root(IN PMRX_NET_ROOT p);
- diff --git a/sys/nfs41sys_driver.c b/sys/nfs41sys_driver.c
- index a4deed7..82e6719 100644
- --- a/sys/nfs41sys_driver.c
- +++ b/sys/nfs41sys_driver.c
- @@ -302,7 +302,7 @@ NTSTATUS marshal_nfs41_header(
- #ifdef DEBUG_MARSHAL_HEADER
- DbgP("[upcall hdr] xid=%lld op='%s'%s filename='%wZ' vers=%d "
- - "sess=0x%p open_state=0x%x\n",
- + "sess=0x%p open_state=0x%p\n",
- entry->xid,
- opcode2string(entry->opcode),
- (entry->async_op?"(async)":""),
- @@ -1330,7 +1330,7 @@ VOID fcbopen_main(PVOID ctx)
- nfs41_fcb_list_entry, next);
- #ifdef DEBUG_TIME_BASED_COHERENCY
- - DbgP("fcbopen_main: Checking attributes for srvopen=%0x%p fcb=0x%p "
- + DbgP("fcbopen_main: Checking attributes for srvopen=0x%p fcb=0x%p "
- "change_time=%llu skipping=%d\n",
- cur->srvopen,
- ((cur->srvopen != NULL)?cur->srvopen->pFcb:NULL),
- diff --git a/sys/nfs41sys_fileinfo.c b/sys/nfs41sys_fileinfo.c
- index 203c503..f871915 100644
- --- a/sys/nfs41sys_fileinfo.c
- +++ b/sys/nfs41sys_fileinfo.c
- @@ -876,14 +876,14 @@ NTSTATUS nfs41_SetFileInformationAtCleanup(
- * unlock-whole-file } manner, doing a set-file-size outside
- * the file lock causes data corruption in such cases.
- */
- - DbgP("nfs41_SetFileInformationAtCleanup: FileEndOfFileInformation NOP\n",
- - (int)InfoClass);
- + DbgP("nfs41_SetFileInformationAtCleanup: "
- + "FileEndOfFileInformation NOP\n");
- status = STATUS_SUCCESS;
- break;
- case FileBasicInformation:
- /* Timestamp updates */
- - DbgP("nfs41_SetFileInformationAtCleanup: FileBasicInformation timestamp updates\n",
- - (int)InfoClass);
- + DbgP("nfs41_SetFileInformationAtCleanup: "
- + "FileBasicInformation timestamp updates\n");
- status = nfs41_SetFileInformationImpl(RxContext,
- NFS41_SYSOP_FILE_SET_AT_CLEANUP);
- break;
- diff --git a/sys/nfs41sys_fsctl.c b/sys/nfs41sys_fsctl.c
- index b79fd30..204631e 100644
- --- a/sys/nfs41sys_fsctl.c
- +++ b/sys/nfs41sys_fsctl.c
- @@ -341,7 +341,7 @@ NTSTATUS unmarshal_nfs41_queryallocatedranges(
- *buf += sizeof(ULONG);
- DbgP("unmarshal_nfs41_queryallocatedranges: "
- - "buffer_overflow=%d returned_size=%llu\n",
- + "buffer_overflow=%d returned_size=%lu\n",
- (int)cur->u.QueryAllocatedRanges.buffer_overflow,
- cur->u.QueryAllocatedRanges.returned_size);
- diff --git a/sys/nfs41sys_mount.c b/sys/nfs41sys_mount.c
- index b1a46b5..c25a132 100644
- --- a/sys/nfs41sys_mount.c
- +++ b/sys/nfs41sys_mount.c
- @@ -411,7 +411,7 @@ NTSTATUS nfs41_MountConfig_ParseINT64(
- }
- else {
- print_error("nfs41_MountConfig_ParseINT64: "
- - "Failed to convert '%s'='%wZ' to unsigned long.\n",
- + "Failed to convert '%ls'='%wZ' to unsigned long.\n",
- Name, usValue);
- }
- @@ -1288,8 +1288,9 @@ NTSTATUS nfs41_CreateVNetRoot(
- ASSERT(existing_mount != NULL);
- /* modify existing mount entry */
- #ifdef DEBUG_MOUNT
- - DbgP("Using existing %d flavor session 0x%x\n",
- - (int)pVNetRootContext->sec_flavor);
- + DbgP("Using existing %d flavor session 0x%p\n",
- + (int)pVNetRootContext->sec_flavor,
- + pVNetRootContext->session);
- #endif
- switch (pVNetRootContext->sec_flavor) {
- case RPCSEC_AUTH_NONE:
- diff --git a/sys/nfs41sys_openclose.c b/sys/nfs41sys_openclose.c
- index 27ea22f..0ab1cf6 100644
- --- a/sys/nfs41sys_openclose.c
- +++ b/sys/nfs41sys_openclose.c
- @@ -333,7 +333,7 @@ NTSTATUS unmarshal_nfs41_open(
- }
- #ifdef DEBUG_MARSHAL_DETAIL
- DbgP("unmarshal_nfs41_open: "
- - "open_state 0x%x fileid=0x%llx fsid=(0x%llx.0x%llx) mode 0%o "
- + "open_state 0x%p fileid=0x%llx fsid=(0x%llx.0x%llx) mode 0%o "
- #ifdef NFS41_DRIVER_FEATURE_LOCAL_UIDGID_IN_NFSV3ATTRIBUTES
- "owner_local_uid %u owner_group_local_gid %u "
- #endif /* NFS41_DRIVER_FEATURE_LOCAL_UIDGID_IN_NFSV3ATTRIBUTES */
- --
- 2.51.0
msnfs41client: Patch for sys: Fix printf()-style&co format argument warnings
Posted by Anonymous on Wed 17th Dec 2025 10:27
raw | new post
Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.
rovema.kpaste.net RSS