Skip to contentSkip to conversation

avoid NULL pointer dereference.

PATCH Applied Tony Breeds 2 participants 2 messages Nov 24, 2005

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 avoid NULL pointer dereference.

Hi All,
xen/common/acm_ops.c, check for a NULL pointer and then
cheerfully dereferences it.

xen/common/acm_ops.c +1 -1
diff -r 4b6e8661fe2b xen/common/acm_ops.c
@@ -172,7 +172,7 @@
             }
             if (subj->ssid == NULL) {
                 put_domain(subj);
-                ret = -ESRCH;
+                return -ESRCH;
             }
             ssidref1 = ((struct acm_ssid_domain *)(subj->ssid))->ssidref;
             put_domain(subj);

Yours Tony

linux.conf.au http://linux.conf.au/ || http://lca2006.linux.org.au/
Jan 23-28 2006 The Australian Linux Technical Conference!

Applied
#1 lore raw
Quoted 5 lines · Tony Breeds

Hi All,
xen/common/acm_ops.c, check for a NULL pointer and then
cheerfully dereferences it.

Applied, but nearby code goto's out so I changed the patch to do that.

In fact there seems to be no convention in that function as to whether returning immediately or goto'ing out (and doing dome return-code cooking) is the right thing to do. Should all the returns be goto out's?

If there is an important distinction then a comment describing it ought to be added.

-- Keir