Fix 'program hangs' defects found by Coverity version 6.5.1:
Improper use of negative value (NEGATIVE_RETURNS)
Variable is passed to a parameter that cannot be negative.
Macro compares unsigned to 0 (NO_EFFECT)
This comparison is always true.
Operands don't affect result (CONSTANT_EXPRESSION_RESULT)
Test is always false regardless of the values of its operands.
Wrong operator used (CONSTANT_EXPRESSION_RESULT)
Test is always true regardless of the values of its operand.
Signed-off-by: Sebastien Buisson <sebastien.buisson@bull.net>
Signed-off-by: Dmitry Eremin <dmitry.eremin@intel.com>
Change-Id: I687a05aaffad13caaebe16edbc4f93ef7ca3413f
Reviewed-on: http://review.whamcloud.com/5888
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
req, lock);
buflen = req_capsule_get_size(&req->rq_pill,
&RMF_DLM_LVB, RCL_SERVER);
req, lock);
buflen = req_capsule_get_size(&req->rq_pill,
&RMF_DLM_LVB, RCL_SERVER);
- buflen = ldlm_lvbo_fill(lock, buf, buflen);
- if (buflen >= 0)
- req_capsule_shrink(&req->rq_pill,
- &RMF_DLM_LVB,
- buflen, RCL_SERVER);
+ if (buflen >= 0) {
+ buflen = ldlm_lvbo_fill(lock, buf,
+ buflen);
+ if (buflen >= 0)
+ req_capsule_shrink(
+ &req->rq_pill,
+ &RMF_DLM_LVB,
+ buflen, RCL_SERVER);
+ else
+ rc = buflen;
+ }
ret = ll_read_ahead_pages(env, io, queue,
ria, &reserved, mapping, &ra_end);
ret = ll_read_ahead_pages(env, io, queue,
ria, &reserved, mapping, &ra_end);
- LASSERTF(reserved >= 0, "reserved %lu\n", reserved);
if (reserved != 0)
ll_ra_count_put(ll_i2sbi(inode), reserved);
if (reserved != 0)
ll_ra_count_put(ll_i2sbi(inode), reserved);
}
ee_free(ee);
} else if (rce->rce_ops == RMT_RSETFACL) {
}
ee_free(ee);
} else if (rce->rce_ops == RMT_RSETFACL) {
- size = lustre_posix_acl_xattr_filter(
- (posix_acl_xattr_header *)value,
- size, &new_value);
- if (unlikely(size < 0))
- RETURN(size);
+ int acl_size = lustre_posix_acl_xattr_filter(
+ (posix_acl_xattr_header *)value,
+ size, &new_value);
+ if (unlikely(acl_size < 0))
+ RETURN(acl_size);
+ size = acl_size;
pv = (const char *)new_value;
} else
pv = (const char *)new_value;
} else
-static int lodname2mdt_index(char *lodname, int *index)
+static int lodname2mdt_index(char *lodname, long *index)
if (mdt == NULL) {
mdt_index = 0;
} else {
if (mdt == NULL) {
mdt_index = 0;
} else {
- lustre_cfg_string(lcfg, 0), &mdt_index);
+ lustre_cfg_string(lcfg, 0),
+ &long_index);
if (rc != 0)
GOTO(out, rc);
if (rc != 0)
GOTO(out, rc);
+ mdt_index = long_index;
}
rc = lod_add_device(env, lod, arg1, index, gen,
mdt_index, LUSTRE_OSC_NAME, 1);
}
rc = lod_add_device(env, lod, arg1, index, gen,
mdt_index, LUSTRE_OSC_NAME, 1);
const char *identity_upcall = "NONE";
struct md_device *next;
int rc;
const char *identity_upcall = "NONE";
struct md_device *next;
int rc;
struct llog_rec_hdr *rec, void *data)
{
struct obd_ioctl_data *ioc_data = (struct obd_ioctl_data *)data;
struct llog_rec_hdr *rec, void *data)
{
struct obd_ioctl_data *ioc_data = (struct obd_ioctl_data *)data;
- static int l, remains, from, to;
+ static int l, remains;
+ static long from, to;
static char *out;
char *endp;
int cur_index, rc = 0;
static char *out;
char *endp;
int cur_index, rc = 0;
struct llog_rec_hdr *rec, void *data)
{
struct obd_ioctl_data *ioc_data = (struct obd_ioctl_data *)data;
struct llog_rec_hdr *rec, void *data)
{
struct obd_ioctl_data *ioc_data = (struct obd_ioctl_data *)data;
- static int l, remains, from, to;
+ static int l, remains;
+ static long from, to;
static char *out;
char *endp;
int cur_index;
static char *out;
char *endp;
int cur_index;
struct obd_import *imp;
class_uuid_t uuid;
char *src, *tgt, *mdt, *osdname = NULL;
struct obd_import *imp;
class_uuid_t uuid;
char *src, *tgt, *mdt, *osdname = NULL;
} else {
/* New OSC name fsname-OSTXXXX-osc-MDTXXXX */
if (strncmp(tgt, "-MDT", 4) != 0 &&
} else {
/* New OSC name fsname-OSTXXXX-osc-MDTXXXX */
if (strncmp(tgt, "-MDT", 4) != 0 &&
- strncmp(tgt, "-OST", 4) != 0) {
+ strncmp(tgt, "-OST", 4) != 0) {
CERROR("%s: invalid target name %s\n",
m->opd_obd->obd_name, lustre_cfg_string(cfg, 0));
RETURN(-EINVAL);
CERROR("%s: invalid target name %s\n",
m->opd_obd->obd_name, lustre_cfg_string(cfg, 0));
RETURN(-EINVAL);
int num_obds, int **obdindexes, int *obdindex,
enum tgt_type type)
{
int num_obds, int **obdindexes, int *obdindex,
enum tgt_type type)
{
- int ret, obdcount, obd_valid = 0, obdnum, i;
+ int ret, obdcount, obd_valid = 0, obdnum;
+ long i;
struct obd_uuid *uuids = NULL;
char buf[16];
int *indexes;
struct obd_uuid *uuids = NULL;
char buf[16];
int *indexes;
{
char fsname[20];
char *ptr;
{
char fsname[20];
char *ptr;
+ int fd, rc;
+ long index;
/* Take path, fsname, or MDTname. Assume MDT0000 in the former cases.
Open root and parse mdt index. */
/* Take path, fsname, or MDTname. Assume MDT0000 in the former cases.
Open root and parse mdt index. */
int llapi_changelog_clear(const char *mdtname, const char *idstr,
long long endrec)
{
int llapi_changelog_clear(const char *mdtname, const char *idstr,
long long endrec)
{
if (endrec < 0) {
llapi_err_noerrno(LLAPI_MSG_ERROR,
if (endrec < 0) {
llapi_err_noerrno(LLAPI_MSG_ERROR,