lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1394024676-35160-1-git-send-email-maxin.john@enea.com>
Date:	Wed,  5 Mar 2014 14:04:35 +0100
From:	"Maxin B. John" <maxin.john@...il.com>
To:	linux-kernel@...r.kernel.org, devel@...verdev.osuosl.org
Cc:	gregkh@...uxfoundation.org, andreas.dilger@...el.com,
	josh@...htriplett.org, bergwolf@...il.com,
	dulshani.gunawardhana89@...il.com, jinshan.xiong@...el.com,
	alexey.zhuravlev@...el.com, "Maxin B. John" <maxin.john@...a.com>
Subject: [PATCH 1/2] lustre/mdc_lib: fix possible null pointer dereference

From: "Maxin B. John" <maxin.john@...a.com>

cppcheck reported possible null pointer dereference in mdc_lib.c

[lustre/lustre/mdc/mdc_lib.c:233]: (error) Possible null pointer dereference
: op_data - otherwise it is redundant to check if op_data is null at line 226

Signed-off-by: Maxin B. John <maxin.john@...a.com>
---
 drivers/staging/lustre/lustre/mdc/mdc_lib.c |   41 ++++++++++++++-------------
 1 file changed, 21 insertions(+), 20 deletions(-)

diff --git a/drivers/staging/lustre/lustre/mdc/mdc_lib.c b/drivers/staging/lustre/lustre/mdc/mdc_lib.c
index 91f6876..594e07c 100644
--- a/drivers/staging/lustre/lustre/mdc/mdc_lib.c
+++ b/drivers/staging/lustre/lustre/mdc/mdc_lib.c
@@ -223,29 +223,30 @@ void mdc_open_pack(struct ptlrpc_request *req, struct md_op_data *op_data,
 	rec->cr_fsuid    = from_kuid(&init_user_ns, current_fsuid());
 	rec->cr_fsgid    = from_kgid(&init_user_ns, current_fsgid());
 	rec->cr_cap      = cfs_curproc_cap_pack();
+
 	if (op_data != NULL) {
 		rec->cr_fid1 = op_data->op_fid1;
 		rec->cr_fid2 = op_data->op_fid2;
-	}
-	rec->cr_mode     = mode;
-	cr_flags = mds_pack_open_flags(flags, mode);
-	rec->cr_rdev     = rdev;
-	rec->cr_time     = op_data->op_mod_time;
-	rec->cr_suppgid1 = op_data->op_suppgids[0];
-	rec->cr_suppgid2 = op_data->op_suppgids[1];
-	rec->cr_bias     = op_data->op_bias;
-	rec->cr_umask    = current_umask();
-	rec->cr_old_handle = op_data->op_handle;
-
-	mdc_pack_capa(req, &RMF_CAPA1, op_data->op_capa1);
-	/* the next buffer is child capa, which is used for replay,
-	 * will be packed from the data in reply message. */
-
-	if (op_data->op_name) {
-		tmp = req_capsule_client_get(&req->rq_pill, &RMF_NAME);
-		LOGL0(op_data->op_name, op_data->op_namelen, tmp);
-		if (op_data->op_bias & MDS_CREATE_VOLATILE)
-			cr_flags |= MDS_OPEN_VOLATILE;
+		rec->cr_mode     = mode;
+		cr_flags = mds_pack_open_flags(flags, mode);
+		rec->cr_rdev     = rdev;
+		rec->cr_time     = op_data->op_mod_time;
+		rec->cr_suppgid1 = op_data->op_suppgids[0];
+		rec->cr_suppgid2 = op_data->op_suppgids[1];
+		rec->cr_bias     = op_data->op_bias;
+		rec->cr_umask    = current_umask();
+		rec->cr_old_handle = op_data->op_handle;
+
+		mdc_pack_capa(req, &RMF_CAPA1, op_data->op_capa1);
+		/* the next buffer is child capa, which is used for replay,
+		* will be packed from the data in reply message. */
+
+		if (op_data->op_name) {
+			tmp = req_capsule_client_get(&req->rq_pill, &RMF_NAME);
+			LOGL0(op_data->op_name, op_data->op_namelen, tmp);
+			if (op_data->op_bias & MDS_CREATE_VOLATILE)
+				cr_flags |= MDS_OPEN_VOLATILE;
+		}
 	}
 
 	if (lmm) {
-- 
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ