From owner-freebsd-arch@freebsd.org Mon Feb 1 20:46:28 2016 Return-Path: Delivered-To: freebsd-arch@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 A5CE6A98F31 for ; Mon, 1 Feb 2016 20:46:28 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mailman.ysv.freebsd.org (mailman.ysv.freebsd.org [IPv6:2001:1900:2254:206a::50:5]) by mx1.freebsd.org (Postfix) with ESMTP id 888878DF for ; Mon, 1 Feb 2016 20:46:28 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mailman.ysv.freebsd.org (Postfix) id 85BA0A98F30; Mon, 1 Feb 2016 20:46:28 +0000 (UTC) Delivered-To: arch@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 8551CA98F2F for ; Mon, 1 Feb 2016 20:46:28 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-qk0-f182.google.com (mail-qk0-f182.google.com [209.85.220.182]) (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 4C7A98DE for ; Mon, 1 Feb 2016 20:46:28 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-qk0-f182.google.com with SMTP id s68so56502951qkh.3 for ; Mon, 01 Feb 2016 12:46:28 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:reply-to:in-reply-to:references :date:message-id:subject:from:to:cc:content-type; bh=sVH7zQrwKpXnUATtAtwp/O1VZbeuzKYtTJsOLmZEfqw=; b=H0KjmGEJq8rb5vUcdmSAh65MPd2rPGPm0ge70rLt+4TfkwRvPXO3FWv8I0zOOea+9z zll6YQz1dAs3SbhfWmoWrrUZXc6AXSowRxCME9eStT13LmM7cj3yFpuvWXpq/6mYKHJm oIlqJJLjuG/dL6EmKXLCfsuprUrr4AxF0Nny6m2ITEE7BDHn5Bq319KL9eF9HMDiPikk sDPUAzPzy8luo8kNcem7pcg+7I5ICW2qm/pDkie/Eo4RG/Ab7HtfAEeRXY7TTkBCWLZv Mi1QR4yUx3567JDzSuthfR6iTs931F68yyUsijeTwrtirUtMvG5lLZ6NJKh4qhCcn4HA zayQ== X-Gm-Message-State: AG10YORl8T14jr7MLQ46jLsOQ3/Bn2WVA4eMelmvq2Qxw6Xo1rPbSiW5nYKIojDWHdFtIg== X-Received: by 10.55.82.2 with SMTP id g2mr30936854qkb.53.1454357817160; Mon, 01 Feb 2016 12:16:57 -0800 (PST) Received: from mail-yk0-f179.google.com (mail-yk0-f179.google.com. [209.85.160.179]) by smtp.gmail.com with ESMTPSA id d188sm13807625qkb.9.2016.02.01.12.16.56 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 01 Feb 2016 12:16:57 -0800 (PST) Received: by mail-yk0-f179.google.com with SMTP id u9so31697704ykd.1 for ; Mon, 01 Feb 2016 12:16:56 -0800 (PST) MIME-Version: 1.0 X-Received: by 10.37.83.133 with SMTP id h127mr13804102ybb.115.1454357816631; Mon, 01 Feb 2016 12:16:56 -0800 (PST) Reply-To: cem@FreeBSD.org Received: by 10.37.4.23 with HTTP; Mon, 1 Feb 2016 12:16:56 -0800 (PST) In-Reply-To: References: Date: Mon, 1 Feb 2016 12:16:56 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: OpenBSD mallocarray From: Conrad Meyer To: C Turt Cc: arch@freebsd.org Content-Type: text/plain; charset=UTF-8 X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Feb 2016 20:46:28 -0000 On Mon, Feb 1, 2016 at 11:57 AM, C Turt wrote: > I've recently started browsing the OpenBSD kernel source code, and have > found the mallocarray function positively wonderful. I would like to > discuss the possibility of getting this into FreeBSD kernel. > > ... > > The mallocarray is a wrapper for malloc which can be used in this > situations to detect an integer overflow before allocating: Sure. +1 from me. I don't think we want the M_CANFAIL hack, though. Best, Conrad