iscsi-scst: Suppress multiple Coverity complaints

Suppress several Coverity "tainted scalar" complaints and also two other
false positive Coverity complaints.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8761 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Bart Van Assche
2020-01-12 05:37:34 +00:00
parent ffd85476ae
commit f0e474c4d8
2 changed files with 29 additions and 0 deletions
+24
View File
@@ -241,6 +241,14 @@ static int del_session(void __user *ptr)
goto out_free;
}
#ifdef __COVERITY__
/* To suppress a Coverity "tainted scalar" complaint. */
if (info->initiator_name[sizeof(info->initiator_name) - 1]) {
err = -EINVAL;
goto out_free;
}
#endif
info->initiator_name[sizeof(info->initiator_name)-1] = '\0';
target = target_lookup_by_id(info->tid);
@@ -322,6 +330,14 @@ static int iscsi_initiator_allowed(void __user *ptr)
goto out;
}
#ifdef __COVERITY__
/* To suppress a Coverity "tainted scalar" complaint. */
if (cinfo.full_initiator_name[sizeof(cinfo.full_initiator_name) - 1]) {
err = -EINVAL;
goto out_free;
}
#endif
cinfo.full_initiator_name[sizeof(cinfo.full_initiator_name)-1] = '\0';
target = target_lookup_by_id(cinfo.tid);
@@ -735,6 +751,14 @@ static int add_target(void __user *ptr)
} else
uinfo = NULL;
#ifdef __COVERITY__
/* To suppress a Coverity "tainted scalar" complaint (CID 344743). */
if (info->attrs_num > 65536) {
err = -EINVAL;
goto out_free;
}
#endif
err = __add_target(info);
if (uinfo != NULL) {
+5
View File
@@ -335,6 +335,9 @@ static struct iscsi_cmnd *cmnd_alloc(struct iscsi_conn *conn,
/* ToDo: __GFP_NOFAIL?? */
cmnd = kmem_cache_zalloc(iscsi_cmnd_cache, GFP_KERNEL|__GFP_NOFAIL);
/* Tell Coverity about __GFP_NOFAIL. */
EXTRACHECKS_BUG_ON(cmnd == NULL);
iscsi_cmnd_init(conn, cmnd, parent);
TRACE_DBG("conn %p, parent %p, cmnd %p", conn, parent, cmnd);
@@ -1620,6 +1623,8 @@ static int cmnd_prepare_recv_pdu(struct iscsi_conn *conn,
offset = 0;
}
/* To suppress a false positive Coverity complaint. */
EXTRACHECKS_BUG_ON(sg == &dummy_sg[0] && idx > 0);
addr = page_address(sg_page(&sg[idx]));
EXTRACHECKS_BUG_ON(addr == NULL);
sg_len = sg[idx].offset + sg[idx].length - offset;