Fix 'error handling issues' defects found by Coverity version
6.0.3:
Unchecked return value (CHECKED_RETURN)
Value returned from a function is not checked for errors before
being used.
Argument cannot be negative (NEGATIVE_RETURNS)
Negative value used as argument to a function expecting a
positive value.
Signed-off-by: Sebastien Buisson <sebastien.buisson@bull.net>
Change-Id: I44022a7d7227ee46345b77701b4c5199a74c386d
Reviewed-on: http://review.whamcloud.com/4772
Tested-by: Hudson
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Keith Mannthey <keith.mannthey@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lprocfs_counter_init(pl->pl_stats, LDLM_POOL_TIMING_STAT,
LPROCFS_CNTR_AVGMINMAX | LPROCFS_CNTR_STDDEV,
"recalc_timing", "sec");
lprocfs_counter_init(pl->pl_stats, LDLM_POOL_TIMING_STAT,
LPROCFS_CNTR_AVGMINMAX | LPROCFS_CNTR_STDDEV,
"recalc_timing", "sec");
- lprocfs_register_stats(pl->pl_proc_dir, "stats", pl->pl_stats);
+ rc = lprocfs_register_stats(pl->pl_proc_dir, "stats", pl->pl_stats);
push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
rc = llog_open(NULL, ctxt, &llh, NULL, name, LLOG_OPEN_EXISTS);
if (rc == 0) {
push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
rc = llog_open(NULL, ctxt, &llh, NULL, name, LLOG_OPEN_EXISTS);
if (rc == 0) {
- llog_init_handle(NULL, llh, LLOG_F_IS_PLAIN, NULL);
- rc = llog_get_size(llh);
+ rc = llog_init_handle(NULL, llh, LLOG_F_IS_PLAIN, NULL);
+ if (rc == 0)
+ rc = llog_get_size(llh);
llog_close(NULL, llh);
} else if (rc == -ENOENT) {
rc = 0;
llog_close(NULL, llh);
} else if (rc == -ENOENT) {
rc = 0;
- llog_init_handle(env, llh, LLOG_F_IS_PLAIN, NULL);
+ rc = llog_init_handle(env, llh, LLOG_F_IS_PLAIN, NULL);
if (rc)
GOTO(out_close, rc);
rc = llog_get_size(llh);
if (rc)
GOTO(out_close, rc);
rc = llog_get_size(llh);
-void lu_debugging_setup(void)
+int lu_debugging_setup(void)
- lu_env_init(&lu_debugging_env, ~0);
+ return lu_env_init(&lu_debugging_env, ~0);
}
void lu_context_keys_dump(void)
}
void lu_context_keys_dump(void)
}
/* get attr to return */
}
/* get attr to return */
- dt_attr_get(env, o, la, ofd_object_capa(env, fo));
+ rc = dt_attr_get(env, o, la, ofd_object_capa(env, fo));
out_stop:
/* Force commit to make the just-deleted blocks
out_stop:
/* Force commit to make the just-deleted blocks
LPROCFS_CNTR_AVGMINMAX,
"thandle closing", "usec");
#endif
LPROCFS_CNTR_AVGMINMAX,
"thandle closing", "usec");
#endif
- lprocfs_seq_create(osd->od_proc_entry, "brw_stats",
- 0644, &osd_brw_stats_fops, osd);
+ result = lprocfs_seq_create(osd->od_proc_entry, "brw_stats",
+ 0644, &osd_brw_stats_fops, osd);
rc = osd_read_ldd(source, ldd);
if (rc) {
fprintf(stderr, "%s: %s failed to read permanent mount"
rc = osd_read_ldd(source, ldd);
if (rc) {
fprintf(stderr, "%s: %s failed to read permanent mount"
- " data: %s\n", progname, source, strerror(rc));
+ " data: %s\n", progname, source,
+ rc >= 0 ? strerror(rc) : "");
continue;
if (ret) {
fprintf(stderr, "%s: error %d on losetup: %s\n",
continue;
if (ret) {
fprintf(stderr, "%s: error %d on losetup: %s\n",
- progname, ret, strerror(ret));
+ progname, ret,
+ ret >= 0 ? strerror(ret) : "");
return ret;
}
strscpy(mop->mo_loopdev, l_device,
return ret;
}
strscpy(mop->mo_loopdev, l_device,
memset(buf, 0, sizeof(rawbuf));
rc = obd_ioctl_pack(&data, &buf, sizeof(rawbuf));
memset(buf, 0, sizeof(rawbuf));
rc = obd_ioctl_pack(&data, &buf, sizeof(rawbuf));
fprintf(stderr, "error: %s: invalid ioctl\n",
jt_cmdname(func));
fprintf(stderr, "error: %s: invalid ioctl\n",
jt_cmdname(func));
}
rc = l2_ioctl(OBD_DEV_ID, OBD_IOC_NAME2DEV, buf);
if (rc < 0)
}
rc = l2_ioctl(OBD_DEV_ID, OBD_IOC_NAME2DEV, buf);
if (rc < 0)