From owner-svn-src-head@freebsd.org Thu Oct 26 02:24:16 2017 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 5F28DE31442; Thu, 26 Oct 2017 02:24:16 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-io0-f177.google.com (mail-io0-f177.google.com [209.85.223.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3006666959; Thu, 26 Oct 2017 02:24:15 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-io0-f177.google.com with SMTP id n137so3116360iod.6; Wed, 25 Oct 2017 19:24:15 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:reply-to:in-reply-to:references :from:date:message-id:subject:to:cc; bh=rv/fTyCO56DUcoViHJBSX69iy1VfSQIJNsJFKdftfuo=; b=XtOFVp3wTvs1R/ob1m5d6vGnB5bFFeGsdsIQdHldUgJA6KmzXGrfCfNTXYIM0U2fA6 kIDg2InWRokhbGiNs3rLf+Y7CqgCeWNEURM6FihAylBN3ZW+Wjkin0uCMQhJcAR404YP zfenolBweUQyKfF9hPTxaYrufiQ1u7/Mo9uSvzL5P5FPqcAmgyzLMPfhZKPqvHBcsdCm 2tsX0Hz0jdtDEdyk3WhQTT4UwC5LkoLh500AgKaUbib/KvB8dYbWrnUe4EqSWSjz9NIG u9JS1srKccdHbDxxmacG+YteKycrsO8lIEUCfRsR7b22/i/kgfLpwQZG1DxS6/l5P1EW 80SQ== X-Gm-Message-State: AMCzsaXDGgdoeeLoQPfFXBaZM2L6Cqz+xkhCjhy5EKbr8+sU6JQ94AtW aB55Mf6B2CGwqqgCNStqAcRuqXVp X-Google-Smtp-Source: ABhQp+QlhpwaUM32DhjABRCA8Jipbj7gUt2SXFtD5gWqtgi6vsyMqmPRFqryhx1JCdtlOUOkB0oF6w== X-Received: by 10.107.56.130 with SMTP id f124mr3611916ioa.33.1508984220198; Wed, 25 Oct 2017 19:17:00 -0700 (PDT) Received: from mail-it0-f43.google.com (mail-it0-f43.google.com. [209.85.214.43]) by smtp.gmail.com with ESMTPSA id q202sm1835388iod.85.2017.10.25.19.16.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 25 Oct 2017 19:16:59 -0700 (PDT) Received: by mail-it0-f43.google.com with SMTP id l196so3299082itl.4; Wed, 25 Oct 2017 19:16:59 -0700 (PDT) X-Received: by 10.36.53.15 with SMTP id k15mr443227ita.75.1508984219732; Wed, 25 Oct 2017 19:16:59 -0700 (PDT) MIME-Version: 1.0 Reply-To: cem@freebsd.org Received: by 10.2.164.130 with HTTP; Wed, 25 Oct 2017 19:16:59 -0700 (PDT) In-Reply-To: <201710232312.v9NNC1B0011025@repo.freebsd.org> References: <201710232312.v9NNC1B0011025@repo.freebsd.org> From: Conrad Meyer Date: Wed, 25 Oct 2017 19:16:59 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r324941 - in head: lib/libc/sys sys/kern To: Alan Somers Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org, John Baldwin Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 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: Thu, 26 Oct 2017 02:24:16 -0000 Hi Alan, Coverity reports a mismatch between the loop quoted in the context below and the dynamic array size nent. (The mismatch predates your change, due to the invariant nent <= aio_listio_max and aiol_zone sized in terms of aio_listio_max.) CID is 1382114. On Mon, Oct 23, 2017 at 4:12 PM, Alan Somers wrote: > Author: asomers > Date: Mon Oct 23 23:12:01 2017 > New Revision: 324941 > URL: https://svnweb.freebsd.org/changeset/base/324941 > > Log: > Remove artificial restriction on lio_listio's operation count > ... > Modified: head/sys/kern/vfs_aio.c > ============================================================================== > --- head/sys/kern/vfs_aio.c Mon Oct 23 23:05:29 2017 (r324940) > +++ head/sys/kern/vfs_aio.c Mon Oct 23 23:12:01 2017 (r324941) >... > @@ -2812,7 +2809,7 @@ freebsd32_aio_suspend(struct thread *td, struct freebs > } else > tsp = NULL; > > - ujoblist = uma_zalloc(aiol_zone, M_WAITOK); > + ujoblist = malloc(uap->nent * sizeof(ujoblist[0]), M_AIOS, M_WAITOK); > ujoblist32 = (uint32_t *)ujoblist; > error = copyin(uap->aiocbp, ujoblist32, uap->nent * > sizeof(ujoblist32[0])); > if (error == 0) { > for (i = uap->nent; i > 0; i--) Probably, this should be: for (i = uap->nent - 1; i > 0; i--) > ujoblist[i] = PTRIN(ujoblist32[i]); > > error = kern_aio_suspend(td, uap->nent, ujoblist, tsp); > } > - uma_zfree(aiol_zone, ujoblist); > + free(ujoblist, M_AIOS); > return (error); > } I think this loop was wrong when it was introduced in r185878, but have not investigated that thoroughly. Best, Conrad