Skip to contentSkip to conversation

IA32 (2.6.8.1 - 2004-08-23.21.30) - 3 New warnings (gcc 3.2.2)

DISCUSSION John Cherry 4 participants 4 messages Aug 24, 2004 SELinux security module

lore
Share & tools
lore
#0 lore raw

drivers/scsi/BusLogic.c:2976: warning: BusLogic_AbortCommand' defined but not used security/selinux/hooks.c:2825: warning: ret' might be used uninitialized in this function security/selinux/hooks.c:2886: warning: `ret' might be used uninitialized in this function

#1 lore raw

2.6.9-rc1: selinux/hooks.c: functions returning unassigned variables

Quoted 3 lines · John Cherry

...
security/selinux/hooks.c:2825: warning: ret' might be used uninitialized in this function security/selinux/hooks.c:2886: warning: ret' might be used uninitialized in this function

This was
[NET]: Add skb_header_pointer, and use it where possible.

@Dave:
In both functions ret is returned, but line that assigned a value to ret was removed.

*shrug*

cu
Adrian

Signature · 4 lines
       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed
#2 lore raw

Re: 2.6.9-rc1: selinux/hooks.c: functions returning unassigned variables

Quoted 6 lines · Adrian Bunk
Quoted 3 lines · John Cherry

...
security/selinux/hooks.c:2825: warning: ret' might be used uninitialized in this function security/selinux/hooks.c:2886: warning: ret' might be used uninitialized in this function

Quoted 7 lines

This was
[NET]: Add skb_header_pointer, and use it where possible.

@Dave:
In both functions ret is returned, but line that assigned a value to ret was removed.

===== security/selinux/hooks.c 1.54 vs edited =====

security/selinux/hooks.c +4 -2
@@ -2822,7 +2822,7 @@
 /* Returns error only if unable to parse addresses */
 static int selinux_parse_skb_ipv4(struct sk_buff *skb, struct avc_audit_data *ad)
 {
-	int offset, ihlen, ret;
+	int offset, ihlen, ret = -EINVAL;
 	struct iphdr _iph, *ih;
 
 	offset = skb->nh.raw - skb->data;
@@ -2836,6 +2836,7 @@
 
 	ad->u.net.v4info.saddr = ih->saddr;
 	ad->u.net.v4info.daddr = ih->daddr;
+	ret = 0;
 
 	switch (ih->protocol) {
         case IPPROTO_TCP: {
@@ -2883,7 +2884,7 @@
 static int selinux_parse_skb_ipv6(struct sk_buff *skb, struct avc_audit_data *ad)
 {
 	u8 nexthdr;
-	int ret, offset;
+	int ret = -EINVAL, offset;
 	struct ipv6hdr _ipv6h, *ip6;
 
 	offset = skb->nh.raw - skb->data;
@@ -2893,6 +2894,7 @@
 
 	ipv6_addr_copy(&ad->u.net.v6info.saddr, &ip6->saddr);
 	ipv6_addr_copy(&ad->u.net.v6info.daddr, &ip6->daddr);
+	ret = 0;
 
 	nexthdr = ip6->nexthdr;
 	offset += sizeof(_ipv6h);
Signature · 2 lines
Stephen Smalley <[email protected]>
National Security Agency
#3 lore raw

Re: 2.6.9-rc1: selinux/hooks.c: functions returning unassigned variables

Quoted 7 lines · On Tue, 24 Aug 2004 11:41:45 -0400 Stephen Smalley <[email protected]> wrote:
Quoted 6 lines · Adrian Bunk
Quoted 3 lines · John Cherry

...
security/selinux/hooks.c:2825: warning: ret' might be used uninitialized in this function security/selinux/hooks.c:2886: warning: ret' might be used uninitialized in this function

Quoted 7 lines
Quoted 7 lines

This was
[NET]: Add skb_header_pointer, and use it where possible.

@Dave:
In both functions ret is returned, but line that assigned a value to ret was removed.

Good catch. Patch applied, thanks Stephen.