pastebin - collaborative debugging tool
rovema.kpaste.net RSS


msnfs41client: Fix off-by-one regression in daemon/util.c's |bitmap4.count| |EASSERT()| tests
Posted by Anonymous on Fri 30th Aug 2024 10:40
raw | new post

  1. From 43888120cdcaa7f8a6ec28b542afd4f6072cc728 Mon Sep 17 00:00:00 2001
  2. From: Roland Mainz <roland.mainz@nrubsig.org>
  3. Date: Fri, 30 Aug 2024 11:27:56 +0200
  4. Subject: [PATCH] daemon: Fix |bitmap4| |.count| |EASSERT()| tests in
  5.  daemon/util.c
  6.  
  7. Fix regression from "daemon: Add more asserts to verify
  8. whether nfs41_file_info data are valid", where the |EASSERT()|
  9. tests for |bitmap4| |.count| were off by one.
  10.  
  11. Reviewed-by: Dan Shelton <dan.f.shelton@gmail.com>
  12. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  13. ---
  14.  daemon/util.c | 8 ++++----
  15.  1 file changed, 4 insertions(+), 4 deletions(-)
  16.  
  17. diff --git a/daemon/util.c b/daemon/util.c
  18. index c0d0f15..fd56972 100644
  19. --- a/daemon/util.c
  20. +++ b/daemon/util.c
  21. @@ -158,7 +158,7 @@ ULONG nfs_file_info_to_attributes(
  22.              info->type));
  23.      }
  24.  
  25. -    EASSERT((info->attrmask.count > 1) &&
  26. +    EASSERT((info->attrmask.count > 0) &&
  27.          (info->attrmask.arr[1] & FATTR4_WORD1_MODE));
  28.      if (info->mode == 0444) /* XXX: 0444 for READONLY */
  29.          attrs |= FILE_ATTRIBUTE_READONLY;
  30. @@ -177,7 +177,7 @@ void nfs_to_basic_info(
  31.      IN const nfs41_file_info *info,
  32.      OUT PFILE_BASIC_INFO basic_out)
  33.  {
  34. -    EASSERT(info->attrmask.count > 1);
  35. +    EASSERT(info->attrmask.count > 0);
  36.  
  37.      if (info->attrmask.arr[1] & FATTR4_WORD1_TIME_CREATE) {
  38.          nfs_time_to_file_time(&info->time_create, &basic_out->CreationTime);
  39. @@ -226,7 +226,7 @@ void nfs_to_standard_info(
  40.      const ULONG FileAttributes = nfs_file_info_to_attributes(info);
  41.  
  42.      EASSERT(info->attrmask.arr[0] & FATTR4_WORD0_SIZE);
  43. -    EASSERT((info->attrmask.count > 1) &&
  44. +    EASSERT((info->attrmask.count > 0) &&
  45.          (info->attrmask.arr[1] & FATTR4_WORD1_NUMLINKS));
  46.  
  47.      std_out->AllocationSize.QuadPart =
  48. @@ -242,7 +242,7 @@ void nfs_to_network_openinfo(
  49.      IN const nfs41_file_info *info,
  50.      OUT PFILE_NETWORK_OPEN_INFORMATION net_out)
  51.  {
  52. -    EASSERT(info->attrmask.count > 1);
  53. +    EASSERT(info->attrmask.count > 0);
  54.  
  55.      if (info->attrmask.arr[1] & FATTR4_WORD1_TIME_CREATE) {
  56.          nfs_time_to_file_time(&info->time_create, &net_out->CreationTime);
  57. --
  58. 2.45.1

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