From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751231AbdFBRY2 (ORCPT ); Fri, 2 Jun 2017 13:24:28 -0400 Received: from mail-pf0-f194.google.com ([209.85.192.194]:36546 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751141AbdFBRY0 (ORCPT ); Fri, 2 Jun 2017 13:24:26 -0400 Date: Fri, 2 Jun 2017 10:24:17 -0700 From: Eric Biggers To: David Howells Cc: keyrings@vger.kernel.org, linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org, Eric Biggers Subject: Re: [PATCH 1/5] KEYS: sanitize add_key() and keyctl() key payloads Message-ID: <20170602172417.GA2938@zzz> References: <20170421083037.12746-2-ebiggers3@gmail.com> <20170421083037.12746-1-ebiggers3@gmail.com> <5744.1496417684@warthog.procyon.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5744.1496417684@warthog.procyon.org.uk> User-Agent: Mutt/1.8.3 (2017-05-23) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jun 02, 2017 at 04:34:44PM +0100, David Howells wrote: > Eric Biggers wrote: > > > error2: > > + memzero_explicit(payload, plen); > > Isn't that wrong? payload can be NULL. > > David If you're talking about memset(NULL, ..., 0) being undefined behavior, it's completely insane but sure, I guess we should add the NULL check to be safe. It would also mean there would be no requirement that "KEYS: fix dereferencing NULL payload with nonzero length" be applied first so the second paragraph of the commit message would be removed. I'll send a v2 of just this patch. Eric