media: strscpy() returns a negative value on failure unlike strlcpy().
authorHans Petter Selasky <hps@selasky.org>
Fri, 25 Jan 2019 13:01:46 +0000 (08:01 -0500)
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>
Tue, 19 Mar 2019 20:33:46 +0000 (16:33 -0400)
strscpy() returns a negative value on failure unlike strlcpy(),
so fix the WARN_ON accordingly.

Signed-off-by: Hans Petter Selasky <hps@selasky.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
[hverkuil-cisco@xs4all.nl: added commit message]
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
drivers/media/v4l2-core/v4l2-ioctl.c

index f6d663934648a7f48e85610c2a910244aa0b3f83..038739584a84b57a5d2e925893238a5cc7ea1f1e 100644 (file)
@@ -1373,7 +1373,7 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt)
        }
 
        if (descr)
-               WARN_ON(strscpy(fmt->description, descr, sz) >= sz);
+               WARN_ON(strscpy(fmt->description, descr, sz) < 0);
        fmt->flags = flags;
 }