pastebin - collaborative debugging tool
rovema.kpaste.net RSS


msnfs41client: Patch for sys: Fix printf()-style&co format argument warnings
Posted by Anonymous on Wed 17th Dec 2025 10:27
raw | new post

  1. From ca82a4f2167cf9f5c918676cb8b59ca8e4ae3d4a Mon Sep 17 00:00:00 2001
  2. From: Dan Shelton <dan.f.shelton@gmail.com>
  3. Date: Wed, 10 Dec 2025 20:59:01 +0100
  4. Subject: [PATCH] sys: Fix printf()-style&co format argument warnings
  5.  
  6. Fix printf()-style&co format argument warnings.
  7.  
  8. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  9. ---
  10. sys/nfs41sys_debug.c     | 23 ++++++++++++++++++-----
  11.  sys/nfs41sys_debug.h     |  9 +++++++--
  12.  sys/nfs41sys_driver.c    |  4 ++--
  13.  sys/nfs41sys_fileinfo.c  |  8 ++++----
  14.  sys/nfs41sys_fsctl.c     |  2 +-
  15.  sys/nfs41sys_mount.c     |  7 ++++---
  16.  sys/nfs41sys_openclose.c |  2 +-
  17.  7 files changed, 37 insertions(+), 18 deletions(-)
  18.  
  19. diff --git a/sys/nfs41sys_debug.c b/sys/nfs41sys_debug.c
  20. index a8513e9..c127324 100644
  21. --- a/sys/nfs41sys_debug.c
  22. +++ b/sys/nfs41sys_debug.c
  23. @@ -62,7 +62,11 @@
  24.  
  25.  //#define INCLUDE_TIMESTAMPS
  26.  
  27. -ULONG __cdecl DbgP(IN PCCH fmt, ...)
  28. +#ifdef _MSC_VER
  29. +ULONG DbgP(_In_z_ _Printf_format_string_ const char *restrict fmt, ...)
  30. +#else
  31. +ULONG DbgP(const char *restrict fmt, ...)
  32. +#endif /* _MSC_VER */
  33.  {
  34.      CHAR msg[512];
  35.      va_list args;
  36. @@ -100,7 +104,11 @@ ULONG __cdecl DbgP(IN PCCH fmt, ...)
  37.      return 0;
  38.  }
  39.  
  40. -ULONG __cdecl print_error(IN PCCH fmt, ...)
  41. +#ifdef _MSC_VER
  42. +ULONG print_error(_In_z_ _Printf_format_string_ const char *restrict fmt, ...)
  43. +#else
  44. +ULONG print_error(const char *restrict fmt, ...)
  45. +#endif /* _MSC_VER */
  46.  {
  47.      CHAR msg[512];
  48.      va_list args;
  49. @@ -342,7 +350,10 @@ void print_file_object(int on, PFILE_OBJECT file)
  50.      DbgP("FsContext 0x%p FsContext2 0x%p\n",
  51.          file->FsContext, file->FsContext2);
  52.      DbgP("DeletePending %d ReadAccess %d WriteAccess %d DeleteAccess %d\n",
  53. -        file->DeletePending, file->WriteAccess, file->DeleteAccess);
  54. +        file->DeletePending,
  55. +        file->ReadAccess,
  56. +        file->WriteAccess,
  57. +        file->DeleteAccess);
  58.      DbgP("SharedRead %d SharedWrite %d SharedDelete %d Flags 0x%x\n",
  59.          file->SharedRead, file->SharedWrite, file->SharedDelete,
  60.          file->Flags);
  61. @@ -526,7 +537,9 @@ void print_nt_create_params(int on, NT_CREATE_PARAMETERS params)
  62.          (params.ShareAccess & FILE_SHARE_DELETE)?"DELETE":"");
  63.  
  64.      DbgP("Desired Access: "
  65. -        "0x%x '%s' '%s' '%s' '%s' '%s' '%s' '%s' '%s' '%s' '%s' '%s'\n",
  66. +        "0x%x "
  67. +        "'%s' '%s' '%s' '%s' '%s' '%s' '%s' '%s' '%s' '%s' '%s' '%s' '%s' "
  68. +        "'%s' '%s' '%s' '%s'\n",
  69.          params.DesiredAccess,
  70.          (params.DesiredAccess & FILE_READ_DATA)?"READ":"",
  71.          (params.DesiredAccess & STANDARD_RIGHTS_READ)?"READ_ACL":"",
  72. @@ -706,7 +719,7 @@ const char *opcode2string(nfs41_opcodes opcode)
  73.  void print_acl_args(
  74.      SECURITY_INFORMATION info)
  75.  {
  76. -    DbgP("Security query: '%s' '%s' '%s'\n",
  77. +    DbgP("Security query: '%s' '%s' '%s' '%s'\n",
  78.          (info & OWNER_SECURITY_INFORMATION)?"OWNER":"",
  79.          (info & GROUP_SECURITY_INFORMATION)?"GROUP":"",
  80.          (info & DACL_SECURITY_INFORMATION)?"DACL":"",
  81. diff --git a/sys/nfs41sys_debug.h b/sys/nfs41sys_debug.h
  82. index d9dd4d0..d84bcb1 100644
  83. --- a/sys/nfs41sys_debug.h
  84. +++ b/sys/nfs41sys_debug.h
  85. @@ -28,8 +28,13 @@ typedef enum _nfs41_opcodes nfs41_opcodes;
  86.  
  87.  #define _DRIVER_NAME_ "NFS4.1 Driver"
  88.  
  89. -ULONG __cdecl DbgP(IN PCCH fmt, ...);
  90. -ULONG __cdecl print_error(IN PCCH fmt, ...);
  91. +#ifdef _MSC_VER
  92. +ULONG DbgP(_In_z_ _Printf_format_string_ const char *restrict fmt, ...);
  93. +ULONG print_error(_In_z_ _Printf_format_string_ const char *restrict fmt, ...);
  94. +#else
  95. +ULONG DbgP(const char *restrict fmt, ...);
  96. +ULONG print_error(const char *restrict fmt, ...);
  97. +#endif /* _MSC_VER */
  98.  VOID print_fo_all(int on, IN PRX_CONTEXT c);
  99.  VOID print_srv_call(IN PMRX_SRV_CALL p);
  100.  VOID print_net_root(IN PMRX_NET_ROOT p);
  101. diff --git a/sys/nfs41sys_driver.c b/sys/nfs41sys_driver.c
  102. index a4deed7..82e6719 100644
  103. --- a/sys/nfs41sys_driver.c
  104. +++ b/sys/nfs41sys_driver.c
  105. @@ -302,7 +302,7 @@ NTSTATUS marshal_nfs41_header(
  106.  
  107.  #ifdef DEBUG_MARSHAL_HEADER
  108.      DbgP("[upcall hdr] xid=%lld op='%s'%s filename='%wZ' vers=%d "
  109. -        "sess=0x%p open_state=0x%x\n",
  110. +        "sess=0x%p open_state=0x%p\n",
  111.          entry->xid,
  112.          opcode2string(entry->opcode),
  113.          (entry->async_op?"(async)":""),
  114. @@ -1330,7 +1330,7 @@ VOID fcbopen_main(PVOID ctx)
  115.                      nfs41_fcb_list_entry, next);
  116.  
  117.  #ifdef DEBUG_TIME_BASED_COHERENCY
  118. -            DbgP("fcbopen_main: Checking attributes for srvopen=%0x%p fcb=0x%p "
  119. +            DbgP("fcbopen_main: Checking attributes for srvopen=0x%p fcb=0x%p "
  120.                  "change_time=%llu skipping=%d\n",
  121.                  cur->srvopen,
  122.                  ((cur->srvopen != NULL)?cur->srvopen->pFcb:NULL),
  123. diff --git a/sys/nfs41sys_fileinfo.c b/sys/nfs41sys_fileinfo.c
  124. index 203c503..f871915 100644
  125. --- a/sys/nfs41sys_fileinfo.c
  126. +++ b/sys/nfs41sys_fileinfo.c
  127. @@ -876,14 +876,14 @@ NTSTATUS nfs41_SetFileInformationAtCleanup(
  128.               * unlock-whole-file } manner, doing a set-file-size outside
  129.               * the file lock causes data corruption in such cases.
  130.               */
  131. -            DbgP("nfs41_SetFileInformationAtCleanup: FileEndOfFileInformation NOP\n",
  132. -                (int)InfoClass);
  133. +            DbgP("nfs41_SetFileInformationAtCleanup: "
  134. +                "FileEndOfFileInformation NOP\n");
  135.              status = STATUS_SUCCESS;
  136.              break;
  137.          case FileBasicInformation:
  138.              /* Timestamp updates */
  139. -            DbgP("nfs41_SetFileInformationAtCleanup: FileBasicInformation timestamp updates\n",
  140. -                (int)InfoClass);
  141. +            DbgP("nfs41_SetFileInformationAtCleanup: "
  142. +                "FileBasicInformation timestamp updates\n");
  143.              status = nfs41_SetFileInformationImpl(RxContext,
  144.                  NFS41_SYSOP_FILE_SET_AT_CLEANUP);
  145.              break;
  146. diff --git a/sys/nfs41sys_fsctl.c b/sys/nfs41sys_fsctl.c
  147. index b79fd30..204631e 100644
  148. --- a/sys/nfs41sys_fsctl.c
  149. +++ b/sys/nfs41sys_fsctl.c
  150. @@ -341,7 +341,7 @@ NTSTATUS unmarshal_nfs41_queryallocatedranges(
  151.      *buf += sizeof(ULONG);
  152.  
  153.      DbgP("unmarshal_nfs41_queryallocatedranges: "
  154. -        "buffer_overflow=%d returned_size=%llu\n",
  155. +        "buffer_overflow=%d returned_size=%lu\n",
  156.          (int)cur->u.QueryAllocatedRanges.buffer_overflow,
  157.          cur->u.QueryAllocatedRanges.returned_size);
  158.  
  159. diff --git a/sys/nfs41sys_mount.c b/sys/nfs41sys_mount.c
  160. index b1a46b5..c25a132 100644
  161. --- a/sys/nfs41sys_mount.c
  162. +++ b/sys/nfs41sys_mount.c
  163. @@ -411,7 +411,7 @@ NTSTATUS nfs41_MountConfig_ParseINT64(
  164.      }
  165.      else {
  166.          print_error("nfs41_MountConfig_ParseINT64: "
  167. -            "Failed to convert '%s'='%wZ' to unsigned long.\n",
  168. +            "Failed to convert '%ls'='%wZ' to unsigned long.\n",
  169.              Name, usValue);
  170.      }
  171.  
  172. @@ -1288,8 +1288,9 @@ NTSTATUS nfs41_CreateVNetRoot(
  173.          ASSERT(existing_mount != NULL);
  174.          /* modify existing mount entry */
  175.  #ifdef DEBUG_MOUNT
  176. -        DbgP("Using existing %d flavor session 0x%x\n",
  177. -            (int)pVNetRootContext->sec_flavor);
  178. +        DbgP("Using existing %d flavor session 0x%p\n",
  179. +            (int)pVNetRootContext->sec_flavor,
  180. +            pVNetRootContext->session);
  181.  #endif
  182.          switch (pVNetRootContext->sec_flavor) {
  183.          case RPCSEC_AUTH_NONE:
  184. diff --git a/sys/nfs41sys_openclose.c b/sys/nfs41sys_openclose.c
  185. index 27ea22f..0ab1cf6 100644
  186. --- a/sys/nfs41sys_openclose.c
  187. +++ b/sys/nfs41sys_openclose.c
  188. @@ -333,7 +333,7 @@ NTSTATUS unmarshal_nfs41_open(
  189.      }
  190.  #ifdef DEBUG_MARSHAL_DETAIL
  191.      DbgP("unmarshal_nfs41_open: "
  192. -        "open_state 0x%x fileid=0x%llx fsid=(0x%llx.0x%llx) mode 0%o "
  193. +        "open_state 0x%p fileid=0x%llx fsid=(0x%llx.0x%llx) mode 0%o "
  194.  #ifdef NFS41_DRIVER_FEATURE_LOCAL_UIDGID_IN_NFSV3ATTRIBUTES
  195.          "owner_local_uid %u owner_group_local_gid %u "
  196.  #endif /* NFS41_DRIVER_FEATURE_LOCAL_UIDGID_IN_NFSV3ATTRIBUTES */
  197. --
  198. 2.51.0

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.

Syntax highlighting:

To highlight particular lines, prefix each line with {%HIGHLIGHT}




All content is user-submitted.
The administrators of this site (kpaste.net) are not responsible for their content.
Abuse reports should be emailed to us at