From 26c1d774b55c4db79bca772941883244986e6f44 Mon Sep 17 00:00:00 2001 From: "Pedro F. Giffuni" Date: Sat, 13 Jan 2018 22:30:30 +0000 Subject: dev: make some use of mallocarray(9). Focus on code where we are doing multiplications within malloc(9). None of these is likely to overflow, however the change is still useful as some static checkers can benefit from the allocation attributes we use for mallocarray. This initial sweep only covers malloc(9) calls with M_NOWAIT. No good reason but I started doing the changes before r327796 and at that time it was convenient to make sure the sorrounding code could handle NULL values. --- sys/dev/syscons/fire/fire_saver.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sys/dev/syscons/fire') diff --git a/sys/dev/syscons/fire/fire_saver.c b/sys/dev/syscons/fire/fire_saver.c index 636f6006a4218..e874bf0b84c5d 100644 --- a/sys/dev/syscons/fire/fire_saver.c +++ b/sys/dev/syscons/fire/fire_saver.c @@ -155,7 +155,7 @@ fire_init(video_adapter_t *adp) scrw = info.vi_width; scrh = info.vi_height; - buf = (u_char *)malloc(scrw * (scrh + 1), M_DEVBUF, M_NOWAIT); + buf = (u_char *)mallocarray(scrw, scrh + 1, M_DEVBUF, M_NOWAIT); if (buf) { bzero(buf, scrw * (scrh + 1)); } else { -- cgit v1.3