Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp6374809imu; Tue, 13 Nov 2018 23:56:51 -0800 (PST) X-Google-Smtp-Source: AJdET5eczZoNTxtsWnhYRuMaBHIWa8s3a2MGkPpx7VGy2YItQtgWWnP5Y+jVt1JyWBC5YTW2Kf3I X-Received: by 2002:a63:c10f:: with SMTP id w15mr781912pgf.199.1542182211564; Tue, 13 Nov 2018 23:56:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542182211; cv=none; d=google.com; s=arc-20160816; b=1BUvzrsSL1tXsZavZfzDgcjhYc3sFIvrrc/OvuFXkfovLXNFLO6qn4c6BflGUjTm6R MD1s3+OCu35OGEp99BtcIlgsiQB+pKjyOOswk1tRaF/6shYUNGw3blolJozkO5NR6aLc TLaV2fsSs3DEIiqnB0EvMMwAt2unoaWHflsUGb8IvqOohU9N6ScPVGvdkmQAPI3Da2bj 9zndfTftYYE0Ax1+bsup1jFoTlWs+O5xZnP1znNpQVJA+spYt/XKfWBt2Gep5QlVTnfj 5tIVCmkvnDzNhZOUol1C7FP/pqVRCJvWlLWCjkhk/Zc5sBBl0cHDxJ4dXlpvZSnRYD0e VTjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature; bh=fxTIWxLlGa49q7Y48gaHhJ/0Wcn7grycx+kal8DRCD4=; b=OwDdEZ6/IXFbXTIKgd1NAZo2JIeJ6Rppj+jIQ7LJn3/NCeZJzIKZMtqgebjDOyH1Xz IczzluLkgFgykqwaweP1eH7qD1xzsSihm3mSPsuBQ2JsAulAeKgbjcBPFG0xQyCLZLYU nDN/TEFhhmc//3iMhMderE+pfGcih6bCv0hv+rKaqa0QdDfDLWZSEyPuCgyWLvoF0ycI HYggBOrlYsQ0TgF8vycUJ1v/E2bnMTIln+xJMDgRbqNC5eeoTJiY9PX3r61QyDN5iOXS tG77poGE/zzvnqvZKgYwT8Q3F4y0Die0f8WpSyIadvJ07eD5F8c/aPkoqJImRGhraexT X6Qg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=W0j8+rXe; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c1-v6si22097507pgp.376.2018.11.13.23.56.36; Tue, 13 Nov 2018 23:56:51 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=W0j8+rXe; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731347AbeKNR6V (ORCPT + 99 others); Wed, 14 Nov 2018 12:58:21 -0500 Received: from mail-yb1-f196.google.com ([209.85.219.196]:41263 "EHLO mail-yb1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727154AbeKNR6V (ORCPT ); Wed, 14 Nov 2018 12:58:21 -0500 Received: by mail-yb1-f196.google.com with SMTP id t13-v6so6534918ybb.8 for ; Tue, 13 Nov 2018 23:56:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=fxTIWxLlGa49q7Y48gaHhJ/0Wcn7grycx+kal8DRCD4=; b=W0j8+rXe9PP6eTDoy1fckevT1sgIm41mvdzQRQV/M0urdcVST4zMEfvYcHP6pGxykl ss1XGdga4v2KGX/eeYo9Wg/jJtfPo6saTj0/7j5dU7KLTdrLUlA8WBFrblWW8YQ66kVw 3yOQd33H6mJFrrv7g4ndcTmbynC3WBvknn6N0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=fxTIWxLlGa49q7Y48gaHhJ/0Wcn7grycx+kal8DRCD4=; b=aKq/5+mtPdnnKQ3+MUNpoGQ1wOOJOgVsZbXNypXRXgSJfKtm+2pcNS2L8iXbvHBeeX A+YGCtAREvVzMduKYrWl7eLN4yHzoJhe9Dus5PPmSw2SAkT0rWf4Wq1EccZQ1uWlgeKf 5t+KZT3MzNdKJxlAEpjNBzvDJ6PFxFw/3n6gnO6YUcT57A+aAw9K2ySCiul1lT3JBo9j urfgft1o5/ejhbcAWhwrznh6/Czwt+cjg7lWlETgEpddKE7iUUebPotcK2SSUPbn2NOQ WPxiEz1VkHL7Ca9NqBiLbMxWib15xSDo1+5VGxieT5pWe+Qv7C10611MCfgvPr4HgoJB ua2Q== X-Gm-Message-State: AGRZ1gL4hKoZ8czSFjSPyl+tmiKohZEwJSrASLydJNcgFn9OCrakxH4X uA4G6XlT08IYL9Y9MtyutH7i6AIiMZU= X-Received: by 2002:a25:8809:: with SMTP id c9-v6mr650163ybl.322.1542182173679; Tue, 13 Nov 2018 23:56:13 -0800 (PST) Received: from mail-yw1-f42.google.com (mail-yw1-f42.google.com. [209.85.161.42]) by smtp.gmail.com with ESMTPSA id j64-v6sm4259305ywb.64.2018.11.13.23.56.11 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Nov 2018 23:56:11 -0800 (PST) Received: by mail-yw1-f42.google.com with SMTP id z72-v6so6965230ywa.0 for ; Tue, 13 Nov 2018 23:56:11 -0800 (PST) X-Received: by 2002:a81:29d4:: with SMTP id p203mr623494ywp.407.1542182170924; Tue, 13 Nov 2018 23:56:10 -0800 (PST) MIME-Version: 1.0 Received: by 2002:a25:b906:0:0:0:0:0 with HTTP; Tue, 13 Nov 2018 23:56:09 -0800 (PST) In-Reply-To: <20181102182454.GB14942@google.com> References: <20181101235200.28584-1-keescook@chromium.org> <20181101235200.28584-3-keescook@chromium.org> <20181102182454.GB14942@google.com> From: Kees Cook Date: Wed, 14 Nov 2018 01:56:09 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 2/8] pstore: Do not use crash buffer for decompression To: Joel Fernandes Cc: LKML , Anton Vorontsov , Colin Cross , Tony Luck Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Nov 2, 2018 at 1:24 PM, Joel Fernandes wrote: > On Thu, Nov 01, 2018 at 04:51:54PM -0700, Kees Cook wrote: >> static void decompress_record(struct pstore_record *record) >> { >> + int ret; >> int unzipped_len; > > nit: We could get rid of the unzipped_len variable now I think. I didn't follow this -- it gets used quite a bit. I don't see a clean way to remove it? >> + workspace = kmalloc(unzipped_len + record->ecc_notice_size, > > Should tihs be unzipped_len + record->ecc_notice_size + 1. The extra byte > being for the NULL character of the ecc notice? > > This occurred to me when I saw the + 1 in ram.c. It could be better to just > abstract the size as a macro. Ooh, yes, good catch. I'll get this fixed. Thanks for the review! -- Kees Cook