From 1d3f6a187b1e59516298b95a434526b23afa2ca8 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Sun, 26 May 2013 11:34:22 +0000 Subject: [PATCH] qla2x00t: Avoid dereferencing a NULL pointer (merge r4843 from trunk) git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/2.2.x@4884 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- qla2x00t/qla_init.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/qla2x00t/qla_init.c b/qla2x00t/qla_init.c index 16e75c734..a15b68d49 100644 --- a/qla2x00t/qla_init.c +++ b/qla2x00t/qla_init.c @@ -4207,7 +4207,12 @@ int qla2xxx_tgt_register_driver(struct qla_tgt_data *tgt_data) ENTER(__func__); - if ((tgt_data == NULL) || (tgt_data->magic != QLA2X_TARGET_MAGIC)) { + if (tgt_data == NULL) { + printk(KERN_ERR "***ERROR*** Wrong version of the target mode " + "add-on: tgt_data == NULL\n"); + res = -EINVAL; + goto out; + } else if (tgt_data->magic != QLA2X_TARGET_MAGIC) { printk(KERN_ERR "***ERROR*** Wrong version of the target mode " "add-on: %d\n", tgt_data->magic); res = -EINVAL;