]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
fs: dlm: drop rxbuf manipulation in dlm_copy_master_names
authorAlexander Aring <aahringo@redhat.com>
Tue, 1 Aug 2023 18:09:46 +0000 (14:09 -0400)
committerDavid Teigland <teigland@redhat.com>
Thu, 10 Aug 2023 15:33:03 +0000 (10:33 -0500)
This patch removes the manipulation of the receive buffer in case of an
error and be sure the buffer is null terminated before an error
messagea is printed out. Instead of manipulate the receive buffer we
tell inside the format string the maximum length the string buffer is
being read.

Signed-off-by: Alexander Aring <aahringo@redhat.com>
Signed-off-by: David Teigland <teigland@redhat.com>
fs/dlm/dir.c

index 3bf5bf7a37b4ea7a3e2960b129b2b407a2a3d63a..768cf8d43b2b4b41ce9afd0997d8fc16ae9278ed 100644 (file)
@@ -245,9 +245,8 @@ void dlm_copy_master_names(struct dlm_ls *ls, char *inbuf, int inlen,
        if (inlen > 1) {
                r = find_rsb_root(ls, inbuf, inlen);
                if (!r) {
-                       inbuf[inlen - 1] = '\0';
-                       log_error(ls, "copy_master_names from %d start %d %s",
-                                 nodeid, inlen, inbuf);
+                       log_error(ls, "copy_master_names from %d start %d %.*s",
+                                 nodeid, inlen, inlen, inbuf);
                        goto out;
                }
                list = r->res_root_list.next;