Date: Mon, 15 Jan 2018 21:10:40 +0000 (UTC) From: "Pedro F. Giffuni" <pfg@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328018 - head/sys/powerpc/pseries Message-ID: <201801152110.w0FLAeji061306@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: pfg Date: Mon Jan 15 21:10:40 2018 New Revision: 328018 URL: https://svnweb.freebsd.org/changeset/base/328018 Log: powerpc: make some use of mallocarray(9). Focus on code where we are doing multiplications within malloc(9). None of these ire 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. X-Differential revision: https://reviews.freebsd.org/D13837 Modified: head/sys/powerpc/pseries/phyp_vscsi.c Modified: head/sys/powerpc/pseries/phyp_vscsi.c ============================================================================== --- head/sys/powerpc/pseries/phyp_vscsi.c Mon Jan 15 21:09:58 2018 (r328017) +++ head/sys/powerpc/pseries/phyp_vscsi.c Mon Jan 15 21:10:40 2018 (r328018) @@ -336,8 +336,8 @@ vscsi_attach(device_t dev) mtx_lock(&sc->io_lock); vscsi_setup_bus(sc); - sc->xfer = malloc(sizeof(sc->xfer[0])*sc->max_transactions, M_VSCSI, - M_NOWAIT); + sc->xfer = mallocarray(sc->max_transactions, sizeof(sc->xfer[0]), + M_VSCSI, M_NOWAIT); for (i = 0; i < sc->max_transactions; i++) { xp = &sc->xfer[i]; xp->sc = sc;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201801152110.w0FLAeji061306>