From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.5 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3A2FBC433DF for ; Wed, 24 Jun 2020 17:59:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1F14A2078E for ; Wed, 24 Jun 2020 17:59:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2405777AbgFXR7M (ORCPT ); Wed, 24 Jun 2020 13:59:12 -0400 Received: from verein.lst.de ([213.95.11.211]:45420 "EHLO verein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2405929AbgFXR7L (ORCPT ); Wed, 24 Jun 2020 13:59:11 -0400 Received: by verein.lst.de (Postfix, from userid 2407) id 16BA068B02; Wed, 24 Jun 2020 19:59:05 +0200 (CEST) Date: Wed, 24 Jun 2020 19:59:05 +0200 From: Christoph Hellwig To: Matthew Wilcox Cc: Linus Torvalds , Christoph Hellwig , Al Viro , Luis Chamberlain , Kees Cook , Iurii Zaikin , Linux Kernel Mailing List , linux-fsdevel Subject: Re: [PATCH 03/11] fs: add new read_uptr and write_uptr file operations Message-ID: <20200624175905.GA25981@lst.de> References: <20200624162901.1814136-1-hch@lst.de> <20200624162901.1814136-4-hch@lst.de> <20200624175644.GR21350@casper.infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200624175644.GR21350@casper.infradead.org> User-Agent: Mutt/1.5.17 (2007-11-01) Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org On Wed, Jun 24, 2020 at 06:56:44PM +0100, Matthew Wilcox wrote: > /* don't even try if the size is too large */ > + error = -ENOMEM; > if (count > KMALLOC_MAX_SIZE) > - return -ENOMEM; > + goto out; > + kbuf = kzalloc(count, GFP_KERNEL); > + if (!kbuf) > + goto out; > > if (write) { > + error = -EFAULT; > + if (!copy_from_iter_full(kbuf, count, iter)) > goto out; > } The nul-termination for the write cases seems to be lost here.