From owner-svn-src-head@freebsd.org Tue Jan 16 06:29:27 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C0EA6E7BEC9; Tue, 16 Jan 2018 06:29:27 +0000 (UTC) (envelope-from rpokala@mac.com) Received: from pv33p00im-asmtp001.mac.com (pv33p00im-asmtp001.me.com [17.142.194.250]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A25D368BB3; Tue, 16 Jan 2018 06:29:27 +0000 (UTC) (envelope-from rpokala@mac.com) Received: from process-dkim-sign-daemon.pv33p00im-asmtp001.me.com by pv33p00im-asmtp001.me.com (Oracle Communications Messaging Server 8.0.1.2.20170607 64bit (built Jun 7 2017)) id <0P2M00700WW8LV00@pv33p00im-asmtp001.me.com>; Tue, 16 Jan 2018 06:29:26 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mac.com; s=04042017; t=1516084166; bh=A5SZOur6C83vgqErsJCYUh+OmNpn9YsB1yx2/ThQPRE=; h=Date:Subject:From:To:Message-id:MIME-version:Content-type; b=uPSD+zLBYaUdDq3Apa54UnYZJdXYsT6GJaw+NRtCRfpqvFHpW2GSXBcM46MjiaJ+O eqLT54xOEBGgOHJsNVAixjP0/stzYJLThiRUdUDzxoisPDDTzCIRcHDzJotrUyxpHO KVCZOSxOBA3+WdW8nupC06cjbUygvEGSKeu3GfTlW4UsK47pZ55FiN2hEsuK1nYSQC DXXi1D+3RX216yxTZqRNsmo/9JVvQP6klpPsSh2t43BAft/L0K4ZNUojcnZkCenhtM w2QwJsVjIBjwJpdQdMQ3zRPDGjAiA8aYLX4RJr6yzgip4gs6NST6jSca++6yiaBgHV 22iq41u+rwsmA== Received: from icloud.com ([127.0.0.1]) by pv33p00im-asmtp001.me.com (Oracle Communications Messaging Server 8.0.1.2.20170607 64bit (built Jun 7 2017)) with ESMTPSA id <0P2M00DAHY0ZKA10@pv33p00im-asmtp001.me.com>; Tue, 16 Jan 2018 06:29:25 +0000 (GMT) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2018-01-16_03:,, signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 clxscore=1015 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1707230000 definitions=main-1801160095 User-Agent: Microsoft-MacOutlook/f.29.0.171205 Date: Mon, 15 Jan 2018 22:29:22 -0800 Subject: Re: svn commit: r328020 - in head/sys/mips: mips nlm/dev/sec From: Ravi Pokala To: Pedro Giffuni , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-id: <7275ECDF-EF17-4027-8907-5FE0A28D06F2@mac.com> Thread-topic: svn commit: r328020 - in head/sys/mips: mips nlm/dev/sec References: <201801152113.w0FLDUUn065783@repo.freebsd.org> <560DA44B-159E-431D-B388-4E5E8962E1CD@mac.com> <945535f7-119f-1da4-c64c-f7a7e99e467a@FreeBSD.org> In-reply-to: <945535f7-119f-1da4-c64c-f7a7e99e467a@FreeBSD.org> MIME-version: 1.0 Content-type: text/plain; charset=UTF-8 Content-transfer-encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Jan 2018 06:29:27 -0000 Thanks! -Ravi (rpokala@) -----Original Message----- From: on behalf of Pedro Giffuni Date: 2018-01-15, Monday at 22:06 To: Ravi Pokala , , , Subject: Re: svn commit: r328020 - in head/sys/mips: mips nlm/dev/sec Thanks for the report; On 01/16/18 00:23, Ravi Pokala wrote: > Hi Pedro, > > This change breaks many (most? all?) MIPS kernels (universe, no special config, -DNO_CLEAN): Ugh, yes .. the build was broken by another change so I didn't notice this in my builds. Sorry .. should be fixed as r328041. Pedro. > --- busdma_machdep.o --- > cc1: warnings being treated as errors > /usr/home/rpokala/freebsd/clean/base/head/sys/mips/mips/busdma_machdep.c: In function 'bus_dmamap_create': > /usr/home/rpokala/freebsd/clean/base/head/sys/mips/mips/busdma_machdep.c:539: warning: passing argument 2 of 'malloc' makes pointer from integer without a cast > /usr/home/rpokala/freebsd/clean/base/head/sys/mips/mips/busdma_machdep.c:539: warning: passing argument 3 of 'malloc' makes integer from pointer without a cast > /usr/home/rpokala/freebsd/clean/base/head/sys/mips/mips/busdma_machdep.c:539: error: too many arguments to function 'malloc' > /usr/home/rpokala/freebsd/clean/base/head/sys/mips/mips/busdma_machdep.c: In function 'bus_dmamem_alloc': > /usr/home/rpokala/freebsd/clean/base/head/sys/mips/mips/busdma_machdep.c:651: warning: passing argument 2 of 'malloc' makes pointer from integer without a cast > /usr/home/rpokala/freebsd/clean/base/head/sys/mips/mips/busdma_machdep.c:651: warning: passing argument 3 of 'malloc' makes integer from pointer without a cast > /usr/home/rpokala/freebsd/clean/base/head/sys/mips/mips/busdma_machdep.c:651: error: too many arguments to function 'malloc' > > Thanks, > > Ravi (rpokala@) > > > -----Original Message----- > From: on behalf of "Pedro F. Giffuni" > Date: 2018-01-15, Monday at 13:13 > To: , , > Subject: svn commit: r328020 - in head/sys/mips: mips nlm/dev/sec > > Author: pfg > Date: Mon Jan 15 21:13:30 2018 > New Revision: 328020 > URL: https://svnweb.freebsd.org/changeset/base/328020 > > Log: > mips: 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/mips/mips/busdma_machdep.c > head/sys/mips/nlm/dev/sec/nlmrsa.c > > Modified: head/sys/mips/mips/busdma_machdep.c > ============================================================================== > --- head/sys/mips/mips/busdma_machdep.c Mon Jan 15 21:11:38 2018 (r328019) > +++ head/sys/mips/mips/busdma_machdep.c Mon Jan 15 21:13:30 2018 (r328020) > @@ -345,7 +345,8 @@ _busdma_alloc_dmamap(bus_dma_tag_t dmat) > struct sync_list *slist; > bus_dmamap_t map; > > - slist = malloc(sizeof(*slist) * dmat->nsegments, M_BUSDMA, M_NOWAIT); > + slist = mallocarray(dmat->nsegments, sizeof(*slist), M_BUSDMA, > + M_NOWAIT); > if (slist == NULL) > return (NULL); > map = uma_zalloc_arg(dmamap_zone, dmat, M_NOWAIT); > @@ -534,9 +535,8 @@ bus_dmamap_create(bus_dma_tag_t dmat, int flags, bus_d > int error = 0; > > if (dmat->segments == NULL) { > - dmat->segments = (bus_dma_segment_t *)malloc( > - sizeof(bus_dma_segment_t) * dmat->nsegments, M_BUSDMA, > - M_NOWAIT); > + dmat->segments = (bus_dma_segment_t *)malloc(dmat->nsegments, > + sizeof(bus_dma_segment_t), M_BUSDMA, M_NOWAIT); > if (dmat->segments == NULL) { > CTR3(KTR_BUSDMA, "%s: tag %p error %d", > __func__, dmat, ENOMEM); > @@ -647,9 +647,8 @@ bus_dmamem_alloc(bus_dma_tag_t dmat, void** vaddrp, in > else > mflags = M_WAITOK; > if (dmat->segments == NULL) { > - dmat->segments = (bus_dma_segment_t *)malloc( > - sizeof(bus_dma_segment_t) * dmat->nsegments, M_BUSDMA, > - mflags); > + dmat->segments = (bus_dma_segment_t *)malloc(dmat->nsegments, > + sizeof(bus_dma_segment_t), M_BUSDMA, mflags); > if (dmat->segments == NULL) { > CTR4(KTR_BUSDMA, "%s: tag %p tag flags 0x%x error %d", > __func__, dmat, dmat->flags, ENOMEM); > > Modified: head/sys/mips/nlm/dev/sec/nlmrsa.c > ============================================================================== > --- head/sys/mips/nlm/dev/sec/nlmrsa.c Mon Jan 15 21:11:38 2018 (r328019) > +++ head/sys/mips/nlm/dev/sec/nlmrsa.c Mon Jan 15 21:13:30 2018 (r328020) > @@ -346,7 +346,7 @@ xlp_rsa_newsession(device_t dev, u_int32_t *sidp, stru > > if (ses == NULL) { > sesn = sc->sc_nsessions; > - ses = malloc((sesn + 1) * sizeof(*ses), > + ses = mallocarray(sesn + 1, sizeof(*ses), > M_DEVBUF, M_NOWAIT); > if (ses == NULL) > return (ENOMEM); > @@ -528,8 +528,9 @@ xlp_rsa_kprocess(device_t dev, struct cryptkop *krp, i > goto errout; > } > cmd->rsafn = 0; /* Mod Exp */ > - cmd->rsasrc = malloc( > - cmd->rsaopsize * (krp->krp_iparams + krp->krp_oparams), > + cmd->rsasrc = mallocarray( > + krp->krp_iparams + krp->krp_oparams, > + cmd->rsaopsize, > M_DEVBUF, > M_NOWAIT | M_ZERO); > if (cmd->rsasrc == NULL) { > > > >