Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp3053715ybb; Mon, 6 Apr 2020 00:45:03 -0700 (PDT) X-Google-Smtp-Source: APiQypLnLu7/8YqKxepcULbO/9miLQZsJDH5qOpnqip+8E7ZrxKS7l0VPAr6lk2DurYHLSX+EIe8 X-Received: by 2002:aca:5712:: with SMTP id l18mr11909264oib.178.1586159103046; Mon, 06 Apr 2020 00:45:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586159103; cv=none; d=google.com; s=arc-20160816; b=Xbf7Psvuhx6ZwI7gSRIFQ42cJ9dBjTdZNoU0o+DqvdoJWqTLDGxOC5tGlxLPBnVyHp g8hCfVyVPuZPrI0hbkSMjsf9lpKGLaZ++17n0l/RB9D0BfqBXDc/o+L/uUSjWw/JYFzO lIJuEQ035XO8SUQ09XZdNU3grjKZ1PgxnuaVLHolaPEJpjzMZ4fmjfinthPGPI417rgO Mqmy4wXtX6gIml7j21Y9vpz/ajMHz5oHgSepRjWTi7FPsU2vpLYIETXqY7PNFMhEXUJb SyrLiU0pORGbtK5hPdMwuAXRt9ISgvvYoTWv/4SyStMshA2GMWVBJW+F1deui+PGcaXT YIvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:content-id:mime-version :subject:cc:to:references:in-reply-to:from:organization :dkim-signature; bh=68gqJZ8Lxjhiyta4L8ElEw989A5CNfIKH8Ml7LMQaIg=; b=gy/1e0qWiFB4I7g7rqOgHgQm7eWv5bnWG76GB0JWVKVUTQS6wwFTuBlrAPS6Vx7EZt +BzEB25k4L+RbytfSvGOTPDzCPzwRYsl06miE0aZMWmACiwibcDvgOSh3KX0xfRXVpt1 yW6UEkDQtJzcdByHwgShCkjHBpoGjpcbCe30Z/OFyqPS7m63mRzsqUTGNRaL6akAHSdD vChGmWYRh47jAqnL8c7gSPdsnyNWmDOyWkfjDmFv/PaILdk54C4L7+qH4lGBSldxFeDP S7npetH5Ks22kzT6kjUO17k7H6uBuTGaa8bUvGKFWV0fOcoqS6um9z7/nDBdr+ba5KvO Wx1Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=boQSnqAn; 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r5si7102561otp.241.2020.04.06.00.44.51; Mon, 06 Apr 2020 00:45:03 -0700 (PDT) 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=@redhat.com header.s=mimecast20190719 header.b=boQSnqAn; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726559AbgDFHo0 (ORCPT + 99 others); Mon, 6 Apr 2020 03:44:26 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:28551 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726545AbgDFHoZ (ORCPT ); Mon, 6 Apr 2020 03:44:25 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1586159064; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=68gqJZ8Lxjhiyta4L8ElEw989A5CNfIKH8Ml7LMQaIg=; b=boQSnqAnTV/x2zl7C6n+WxlH+cjEYLhaiyPcRBnzWyCTzxPp3s5X0nM0KnWS7uiFwg9Gy2 T9vC8deJE3Uayh/Ckrnwtob5TabJJUbGPs6h5D6l7wmzeb6eHxOCYxyKtF3d9BidiqaQw1 1awYbxRYIsJRZ1W5XQjgRiTWp4rzVWo= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-27-C1LSPbCDOCa3rPHQcbS7vQ-1; Mon, 06 Apr 2020 03:44:20 -0400 X-MC-Unique: C1LSPbCDOCa3rPHQcbS7vQ-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id F2E058017F3; Mon, 6 Apr 2020 07:44:18 +0000 (UTC) Received: from warthog.procyon.org.uk (ovpn-112-224.rdu2.redhat.com [10.10.112.224]) by smtp.corp.redhat.com (Postfix) with ESMTP id 24D025DA7B; Mon, 6 Apr 2020 07:44:13 +0000 (UTC) Organization: Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 From: David Howells In-Reply-To: References: <20200406023700.1367-1-longman@redhat.com> To: David Rientjes Cc: dhowells@redhat.com, Waiman Long , Andrew Morton , Jarkko Sakkinen , James Morris , "Serge E. Hallyn" , linux-mm@kvack.org, keyrings@vger.kernel.org, linux-kernel@vger.kernel.org, Linus Torvalds Subject: Re: [PATCH] mm: Add kvfree_sensitive() for freeing sensitive data objects MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <6503.1586159053.1@warthog.procyon.org.uk> Date: Mon, 06 Apr 2020 08:44:13 +0100 Message-ID: <6504.1586159053@warthog.procyon.org.uk> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org David Rientjes wrote: > > +static inline void kvfree_sensitive(const void *addr, size_t len) > > +{ > > + if (addr) { > > Shouldn't this be if (unlikely(ZERO_OR_NULL_PTR(addr))? You've reversed the logic - it needs a '!' there. David