git: 3e3314a8b7e3 - main - netmap: fix uint32_t overflow in pool size calculation

Vincenzo Maffione vmaffione at FreeBSD.org
Sun Sep 26 14:08:35 UTC 2021


The branch main has been updated by vmaffione:

URL: https://cgit.FreeBSD.org/src/commit/?id=3e3314a8b7e3dd8d19a209ee2988f724e138a0ae

commit 3e3314a8b7e3dd8d19a209ee2988f724e138a0ae
Author:     Vincenzo Maffione <vmaffione at FreeBSD.org>
AuthorDate: 2021-09-26 13:56:33 +0000
Commit:     Vincenzo Maffione <vmaffione at FreeBSD.org>
CommitDate: 2021-09-26 13:56:33 +0000

    netmap: fix uint32_t overflow in pool size calculation
    
    MFC after:      1 week
---
 sys/dev/netmap/netmap_mem2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/dev/netmap/netmap_mem2.c b/sys/dev/netmap/netmap_mem2.c
index a6be490e5b09..2b41af761c04 100644
--- a/sys/dev/netmap/netmap_mem2.c
+++ b/sys/dev/netmap/netmap_mem2.c
@@ -1702,7 +1702,7 @@ _netmap_mem_private_new(size_t size, struct netmap_obj_params *p, int grp_id,
 				nm_blueprint.pools[i].name,
 				d->name);
 		if (checksz) {
-			uint64_t poolsz = p[i].num * p[i].size;
+			uint64_t poolsz = (uint64_t)p[i].num * p[i].size;
 			if (memtotal < poolsz) {
 				nm_prerr("%s: request too large", d->pools[i].name);
 				err = ENOMEM;


More information about the dev-commits-src-all mailing list