• Dan Carpenter's avatar
    test_firmware: Use correct snprintf() limit · 2418da02
    Dan Carpenter authored
    commit bd17cc5a20ae9aaa3ed775f360b75ff93cd66a1d upstream.
    
    The limit here is supposed to be how much of the page is left, but it's
    just using PAGE_SIZE as the limit.
    
    The other thing to remember is that snprintf() returns the number of
    bytes which would have been copied if we had had enough room.  So that
    means that if we run out of space then this code would end up passing a
    negative value as the limit and the kernel would print an error message.
    I have change the code to use scnprintf() which returns the number of
    bytes that were successfully printed (not counting the NUL terminator).
    
    Fixes: c92316bf ("test_firmware: add batched firmware tests")
    Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
    Cc: stable <stable@vger.kernel.org>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    2418da02