misc/179083: Invalid index calucation in netmap macro expansion

hardik mehta rometoroam at gmail.com
Wed May 29 18:40:00 UTC 2013


>Number:         179083
>Category:       misc
>Synopsis:       Invalid index calucation in netmap macro expansion
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed May 29 18:40:00 UTC 2013
>Closed-Date:
>Last-Modified:
>Originator:     hardik mehta
>Release:        9.1
>Organization:
nik
>Environment:
FreeBSD pcthw21 9.1-RELEASE FreeBSD 9.1-RELEASE
[hmehta at pcthw21 ~]$ sysctl kern.osreldate
kern.osreldate: 901000
>Description:

#define NETMAP_BUF(ring, index)				\
	((char *)(ring) + (ring)->buf_ofs + ((index)*(ring)->nr_buf_size))

In this macro index passed on should be the same as buf_idx from slot structure pointed by ring->cur. As shown in example code instead of using buf_idx pointed of slot structure pointed by ring->cur it uses direct index. Macro should be then expanded as 
#define NETMAP_BUF(ring, index)				\
	((char *)(ring) + (ring)->buf_ofs + ((ring)->slot[index].buf_idx*(ring)->nr_buf_size))
>How-To-Repeat:

>Fix:
define 
#define NETMAP_BUF(ring, index)				\
	((char *)(ring) + (ring)->buf_ofs + ((ring)->slot[index].buf_idx*(ring)->nr_buf_size))

>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list