Subject: kern/1581: Missing and wrong prototypes/function headers for kern/uipc_mbuf.c
To: None <gnats-bugs@gnats.netbsd.org>
From: Ignatios Souvatzis <is@beverly.rhein.de>
List: netbsd-bugs
Date: 10/06/1995 14:09:23
>Number:         1581
>Category:       kern
>Synopsis:       missing/wrong prototypes/function headers in kern/uipc_mbuf.c
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people (Kernel Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Oct  6 09:35:01 1995
>Last-Modified:
>Originator:     Ignatios Souvatzis
>Organization:
	Dis-
>Release:        960930
>Environment:
	
System: NetBSD beverly 1.0A NetBSD 1.0A (BEVERLY) #209: Fri Oct 6 12:48:01 MET 1995 is@beverly:/usr/src/sys/arch/amiga/compile/BEVERLY amiga


>Description:
	m_cat, m_reclaim and m_copydata have no prototype definition im 
	sys/mbuf.h.
	There are a few functions in uipc_mbuf.c with missing return types in
	the function head, leading to the partially wrong default return type
	int.
>How-To-Repeat:
	compile uipc_mbuf.c with -Wall.
	For the missing m_cat prototype, compile net/if_arcsubr.c with -Wall.
>Fix:
	Apply this patch:

Index: sys/mbuf.h
===================================================================
RCS file: /monster/cvs/src/sys/sys/mbuf.h,v
retrieving revision 1.1.1.1
diff -c -r1.1.1.1 mbuf.h
*** mbuf.h	1995/10/03 15:06:03	1.1.1.1
--- mbuf.h	1995/10/06 13:05:35
***************
*** 370,378 ****
--- 370,381 ----
  struct	mbuf *m_retryhdr __P((int, int));
  struct	mbuf *m_split __P((struct mbuf *, int, int));
  void	m_adj __P((struct mbuf *, int));
+ void	m_cat __P((struct mbuf *, struct mbuf *));
  int	m_clalloc __P((int, int));
  void	m_copyback __P((struct mbuf *, int, int, caddr_t));
+ void	m_copydata __P((struct mbuf *, int, int, caddr_t));
  void	m_freem __P((struct mbuf *));
+ void	m_reclaim __P((void));
  
  #ifdef MBTYPES
  int mbtypes[] = {				/* XXX */
Index: kern/uipc_mbuf.c
===================================================================
RCS file: /monster/cvs/src/sys/kern/uipc_mbuf.c,v
retrieving revision 1.1.1.1
diff -c -r1.1.1.1 uipc_mbuf.c
*** uipc_mbuf.c	1995/10/03 15:02:29	1.1.1.1
--- uipc_mbuf.c	1995/10/06 12:57:39
***************
*** 73,78 ****
--- 73,79 ----
   * Must be called at splimp.
   */
  /* ARGSUSED */
+ int
  m_clalloc(ncl, nowait)
  	register int ncl;
  	int nowait;
***************
*** 135,140 ****
--- 136,142 ----
  	return (m);
  }
  
+ void
  m_reclaim()
  {
  	register struct domain *dp;
***************
*** 203,213 ****
  {
  	register struct mbuf *n;
  
! 	if (m == NULL)
  		return;
  	do {
  		MFREE(m, n);
! 	} while (m = n);
  }
  
  /*
--- 205,215 ----
  {
  	register struct mbuf *n;
  
! 	if ((m == NULL))
  		return;
  	do {
  		MFREE(m, n);
! 	} while ((m = n));
  }
  
  /*
***************
*** 321,326 ****
--- 323,329 ----
   * Copy data from an mbuf chain starting "off" bytes from the beginning,
   * continuing for "len" bytes, into the indicated buffer.
   */
+ void
  m_copydata(m, off, len, cp)
  	register struct mbuf *m;
  	register int off;
***************
*** 356,361 ****
--- 359,365 ----
   * Both chains must be of the same type (e.g. MT_DATA).
   * Any m_pkthdr is not updated.
   */
+ void
  m_cat(m, n)
  	register struct mbuf *m, *n;
  {
***************
*** 445,451 ****
  			}
  			count -= m->m_len;
  		}
! 		while (m = m->m_next)
  			m->m_len = 0;
  	}
  }
--- 449,455 ----
  			}
  			count -= m->m_len;
  		}
! 		while ((m = m->m_next))
  			m->m_len = 0;
  	}
  }
>Audit-Trail:
>Unformatted:
Ignatios Souvatzis