drivers/staging/lustre: Fix set-but-unused whinge.
authorValdis Kletnieks <Valdis.Kletnieks@vt.edu>
Wed, 23 Dec 2015 00:36:50 +0000 (19:36 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 3 Feb 2016 22:21:27 +0000 (14:21 -0800)
drivers/staging/lustre/lustre/fid/lproc_fid.c: In function 'ldebugfs_fid_write_common':
drivers/staging/lustre/lustre/fid/lproc_fid.c:67:6: warning: variable 'rc' set but not used [-Wunused-but-set-variable]
  int rc;

We fix it by *using* the return code to help bulletproof it.  It says it's
test code - it should be *more* bulletproof than production, not less.

Signed-off-by: Valdis Kletnieks <Valdis.Kletnieks@vt.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/lustre/lustre/fid/lproc_fid.c

index 39f2aa32e9846d5e4af9ec75f99337e3624ee120..0320b6e8357684958e44c4ff043136aa64650c13 100644 (file)
@@ -85,6 +85,8 @@ ldebugfs_fid_write_common(const char __user *buffer, size_t count,
        rc = sscanf(kernbuf, "[%llx - %llx]\n",
                    (unsigned long long *)&tmp.lsr_start,
                    (unsigned long long *)&tmp.lsr_end);
+       if (rc != 2)
+               return -EINVAL;
        if (!range_is_sane(&tmp) || range_is_zero(&tmp) ||
            tmp.lsr_start < range->lsr_start || tmp.lsr_end > range->lsr_end)
                return -EINVAL;