]> git.baikalelectronics.ru Git - kernel.git/commit
xfs: avoid null *src in memcpy call in xlog_write
authorEric Sandeen <sandeen@redhat.com>
Mon, 12 Oct 2015 05:04:15 +0000 (16:04 +1100)
committerDave Chinner <david@fromorbit.com>
Mon, 12 Oct 2015 05:04:15 +0000 (16:04 +1100)
commit614cde27533b8961d0aca3c0e7da1c126cb1008f
tree5aa10aef830c70180c090d43d4cf905baf5d2f54
parent0c5412fb18b301e32b3233545b755623bc7a857e
xfs: avoid null *src in memcpy call in xlog_write

The gcc undefined behavior sanitizer caught this; surely
any sane memcpy implementation will no-op if size == 0,
but behavior with a *src of NULL is technically undefined
(declared nonnull), so avoid it here.

We are actually in this situation frequently via
xlog_commit_record(), because:

        struct xfs_log_iovec reg = {
                .i_addr = NULL,
                .i_len = 0,
                .i_type = XLOG_REG_TYPE_COMMIT,
        };

Reported-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
fs/xfs/xfs_log.c