Uploaded image for project: 'Lustre'
  1. Lustre
  2. LU-12861

Add and use scnprintf() where using snprintf() is not handling return correctly

Details

    • Task
    • Resolution: Fixed
    • Minor
    • Lustre 2.14.0
    • None
    • None
    • 9223372036854775807

    Description

      There are a few locations where the return value of snprintf() is being used and not checked against the maximum number of characters in the buffer.

      scnprintf() is nearly identical to snprintf() except the return value for scnprintf() is the number of characters written to the buffer (not including the terminating null).

      Where as snprintf() returns the number of characters that would have been written to the buffer, if there was no restriction. Alternatively stated the return value is the size of buffer needed to hold the complete result (not including the terminating null).

      Add scnprintf() wrapper around snprintf() and start using it.

       

      Attachments

        Issue Links

          Activity

            [LU-12861] Add and use scnprintf() where using snprintf() is not handling return correctly
            pjones Peter Jones added a comment -

            It looks like all existing patches tracked under this ticket have landed for 2.14

            pjones Peter Jones added a comment - It looks like all existing patches tracked under this ticket have landed for 2.14

            Oleg Drokin (green@whamcloud.com) merged in patch https://review.whamcloud.com/36901/
            Subject: LU-12861 libcfs: Cleanup libcfs_debug_msg use of snprintf
            Project: fs/lustre-release
            Branch: master
            Current Patch Set:
            Commit: 4ec32fe7c92dce7f6699d36cebac19d8d1abf9e0

            gerrit Gerrit Updater added a comment - Oleg Drokin (green@whamcloud.com) merged in patch https://review.whamcloud.com/36901/ Subject: LU-12861 libcfs: Cleanup libcfs_debug_msg use of snprintf Project: fs/lustre-release Branch: master Current Patch Set: Commit: 4ec32fe7c92dce7f6699d36cebac19d8d1abf9e0

            Oleg Drokin (green@whamcloud.com) merged in patch https://review.whamcloud.com/37046/
            Subject: LU-12861 libcfs: Cleanup use of bare printk
            Project: fs/lustre-release
            Branch: master
            Current Patch Set:
            Commit: b4c8a5180dec2db5bda7c07b8dd3cfbd4f4c1e3f

            gerrit Gerrit Updater added a comment - Oleg Drokin (green@whamcloud.com) merged in patch https://review.whamcloud.com/37046/ Subject: LU-12861 libcfs: Cleanup use of bare printk Project: fs/lustre-release Branch: master Current Patch Set: Commit: b4c8a5180dec2db5bda7c07b8dd3cfbd4f4c1e3f

            Oleg Drokin (green@whamcloud.com) merged in patch https://review.whamcloud.com/36453/
            Subject: LU-12861 libcfs: provide an scnprintf and start using it
            Project: fs/lustre-release
            Branch: master
            Current Patch Set:
            Commit: 998a494fa9a46b92d4c7fb3485a0faeb78beb2cd

            gerrit Gerrit Updater added a comment - Oleg Drokin (green@whamcloud.com) merged in patch https://review.whamcloud.com/36453/ Subject: LU-12861 libcfs: provide an scnprintf and start using it Project: fs/lustre-release Branch: master Current Patch Set: Commit: 998a494fa9a46b92d4c7fb3485a0faeb78beb2cd

            Shaun Tancheff (stancheff@cray.com) uploaded a new patch: https://review.whamcloud.com/37046
            Subject: LU-12861 libcfs: Cleanup use of bare printk
            Project: fs/lustre-release
            Branch: master
            Current Patch Set: 1
            Commit: 22a83a65e67a735b227aec9aa24217dd0dcea3f1

            gerrit Gerrit Updater added a comment - Shaun Tancheff (stancheff@cray.com) uploaded a new patch: https://review.whamcloud.com/37046 Subject: LU-12861 libcfs: Cleanup use of bare printk Project: fs/lustre-release Branch: master Current Patch Set: 1 Commit: 22a83a65e67a735b227aec9aa24217dd0dcea3f1

            Shaun Tancheff (stancheff@cray.com) uploaded a new patch: https://review.whamcloud.com/36901
            Subject: LU-12861 libcfs: Cleanup libcfs_debug_msg use of snprintf
            Project: fs/lustre-release
            Branch: master
            Current Patch Set: 1
            Commit: a28c23ab700dfbacc053d025c372a62577179eb4

            gerrit Gerrit Updater added a comment - Shaun Tancheff (stancheff@cray.com) uploaded a new patch: https://review.whamcloud.com/36901 Subject: LU-12861 libcfs: Cleanup libcfs_debug_msg use of snprintf Project: fs/lustre-release Branch: master Current Patch Set: 1 Commit: a28c23ab700dfbacc053d025c372a62577179eb4

            Shaun Tancheff (stancheff@cray.com) uploaded a new patch: https://review.whamcloud.com/36900
            Subject: LU-12861 libcfs: Cleanup libcfs_debug_msg use of snprintf
            Project: fs/lustre-release
            Branch: master
            Current Patch Set: 1
            Commit: 0aa910a8ad97105aeabf9ac003345aac836d6c65

            gerrit Gerrit Updater added a comment - Shaun Tancheff (stancheff@cray.com) uploaded a new patch: https://review.whamcloud.com/36900 Subject: LU-12861 libcfs: Cleanup libcfs_debug_msg use of snprintf Project: fs/lustre-release Branch: master Current Patch Set: 1 Commit: 0aa910a8ad97105aeabf9ac003345aac836d6c65

            Their are some uses of sprintf for sysfs file handle that needs to be replaced by scnprintf() so don't close once this lands.

            simmonsja James A Simmons added a comment - Their are some uses of sprintf for sysfs file handle that needs to be replaced by scnprintf() so don't close once this lands.

            Shaun Tancheff (stancheff@cray.com) uploaded a new patch: https://review.whamcloud.com/36453
            Subject: LU-12861 libcfs: provide an scnprintf and start using it
            Project: fs/lustre-release
            Branch: master
            Current Patch Set: 1
            Commit: abd5852355901e1da2e7eb85ca0481c36eab1235

            gerrit Gerrit Updater added a comment - Shaun Tancheff (stancheff@cray.com) uploaded a new patch: https://review.whamcloud.com/36453 Subject: LU-12861 libcfs: provide an scnprintf and start using it Project: fs/lustre-release Branch: master Current Patch Set: 1 Commit: abd5852355901e1da2e7eb85ca0481c36eab1235

            People

              stancheff Shaun Tancheff
              stancheff Shaun Tancheff
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: