public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* IA32 (2.6.8.1 - 2004-08-23.21.30) - 3 New warnings (gcc 3.2.2)
@ 2004-08-24 15:19 John Cherry
  2004-08-24 15:33 ` 2.6.9-rc1: selinux/hooks.c: functions returning unassigned variables Adrian Bunk
  0 siblings, 1 reply; 4+ messages in thread
From: John Cherry @ 2004-08-24 15:19 UTC (permalink / raw)
  To: linux-kernel

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* 2.6.9-rc1: selinux/hooks.c: functions returning unassigned variables
  2004-08-24 15:19 IA32 (2.6.8.1 - 2004-08-23.21.30) - 3 New warnings (gcc 3.2.2) John Cherry
@ 2004-08-24 15:33 ` Adrian Bunk
  2004-08-24 15:41   ` Stephen Smalley
  0 siblings, 1 reply; 4+ messages in thread
From: Adrian Bunk @ 2004-08-24 15:33 UTC (permalink / raw)
  To: John Cherry, David S. Miller; +Cc: linux-kernel, sds, jmorris

On Tue, Aug 24, 2004 at 08:19:28AM -0700, John Cherry wrote:
>...
> 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

-- 

       "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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: 2.6.9-rc1: selinux/hooks.c: functions returning unassigned variables
  2004-08-24 15:33 ` 2.6.9-rc1: selinux/hooks.c: functions returning unassigned variables Adrian Bunk
@ 2004-08-24 15:41   ` Stephen Smalley
  2004-08-24 18:50     ` David S. Miller
  0 siblings, 1 reply; 4+ messages in thread
From: Stephen Smalley @ 2004-08-24 15:41 UTC (permalink / raw)
  To: Adrian Bunk; +Cc: John Cherry, David S. Miller, lkml, James Morris

On Tue, 2004-08-24 at 11:33, Adrian Bunk wrote:
> On Tue, Aug 24, 2004 at 08:19:28AM -0700, John Cherry wrote:
> >...
> > 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.

===== security/selinux/hooks.c 1.54 vs edited =====
--- 1.54/security/selinux/hooks.c	2004-08-18 20:14:54 -04:00
+++ edited/security/selinux/hooks.c	2004-08-24 08:43:51 -04:00
@@ -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);

-- 
Stephen Smalley <sds@epoch.ncsc.mil>
National Security Agency


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: 2.6.9-rc1: selinux/hooks.c: functions returning unassigned variables
  2004-08-24 15:41   ` Stephen Smalley
@ 2004-08-24 18:50     ` David S. Miller
  0 siblings, 0 replies; 4+ messages in thread
From: David S. Miller @ 2004-08-24 18:50 UTC (permalink / raw)
  To: Stephen Smalley; +Cc: bunk, cherry, linux-kernel, jmorris

On Tue, 24 Aug 2004 11:41:45 -0400
Stephen Smalley <sds@epoch.ncsc.mil> wrote:

> On Tue, 2004-08-24 at 11:33, Adrian Bunk wrote:
> > On Tue, Aug 24, 2004 at 08:19:28AM -0700, John Cherry wrote:
> > >...
> > > 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.

Good catch.  Patch applied, thanks Stephen.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2004-08-24 18:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-08-24 15:19 IA32 (2.6.8.1 - 2004-08-23.21.30) - 3 New warnings (gcc 3.2.2) John Cherry
2004-08-24 15:33 ` 2.6.9-rc1: selinux/hooks.c: functions returning unassigned variables Adrian Bunk
2004-08-24 15:41   ` Stephen Smalley
2004-08-24 18:50     ` David S. Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox