Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 24 Sep 2020 20:01:31 +0000 (UTC)
From:      Vincenzo Maffione <vmaffione@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org
Subject:   svn commit: r366130 - stable/12/lib/libnetmap
Message-ID:  <202009242001.08OK1VPO064677@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: vmaffione
Date: Thu Sep 24 20:01:31 2020
New Revision: 366130
URL: https://svnweb.freebsd.org/changeset/base/366130

Log:
  MFC r366011
  
  libnetmap: fix cast from uint64_t to void*
  
  We use uintptr_t as an intermediate cast to avoid compiler
  warnings on 32 bit architectures.
  
  Reported by:    adrian

Modified:
  stable/12/lib/libnetmap/libnetmap.h
  stable/12/lib/libnetmap/nmport.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/lib/libnetmap/libnetmap.h
==============================================================================
--- stable/12/lib/libnetmap/libnetmap.h	Thu Sep 24 19:59:29 2020	(r366129)
+++ stable/12/lib/libnetmap/libnetmap.h	Thu Sep 24 20:01:31 2020	(r366130)
@@ -554,9 +554,9 @@ struct nmreq_option *nmreq_find_option(struct nmreq_he
 void nmreq_free_options(struct nmreq_header *);
 const char* nmreq_option_name(uint32_t);
 #define nmreq_foreach_option(h_, o_) \
-	for ((o_) = (struct nmreq_option *)((h_)->nr_options);\
+	for ((o_) = (struct nmreq_option *)((uintptr_t)((h_)->nr_options));\
 	     (o_) != NULL;\
-	     (o_) = (struct nmreq_option *)((o_)->nro_next))
+	     (o_) = (struct nmreq_option *)((uintptr_t)((o_)->nro_next)))
 
 /* nmctx manipulation */
 

Modified: stable/12/lib/libnetmap/nmport.c
==============================================================================
--- stable/12/lib/libnetmap/nmport.c	Thu Sep 24 19:59:29 2020	(r366129)
+++ stable/12/lib/libnetmap/nmport.c	Thu Sep 24 20:01:31 2020	(r366130)
@@ -614,7 +614,7 @@ nmport_mmap(struct nmport_d *d)
 		}
 		memset(m, 0, sizeof(*m));
 		if (d->extmem != NULL) {
-			m->mem = (void *)d->extmem->nro_usrptr;
+			m->mem = (void *)((uintptr_t)d->extmem->nro_usrptr);
 			m->size = d->extmem->nro_info.nr_memsize;
 			m->is_extmem = 1;
 		} else {



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