Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 29 May 2013 18:32:13 GMT
From:      hardik mehta <rometoroam@gmail.com>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   misc/179083: Invalid index calucation in netmap macro expansion 
Message-ID:  <201305291832.r4TIWDiv008127@oldred.FreeBSD.org>
Resent-Message-ID: <201305291840.r4TIe0X7002448@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>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@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:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201305291832.r4TIWDiv008127>