Received: by 2002:ab2:6991:0:b0:1f7:f6c3:9cb1 with SMTP id v17csp118971lqo; Tue, 7 May 2024 14:14:22 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWOccBoS56oQQBIjXdHvoqoCgzhK2B0yXfXQgfBlVBA/jGYaL2nZgV17M0pGo+LaNRW4itHyB40TydnnHunVp7FYIcUJgCv0a3hEamPIA== X-Google-Smtp-Source: AGHT+IHixkcw+yQo97KavRHA/0Zhyh9s1pybH0M7Apxik3M0nqtT9MefeiAodKkKvlNSkYyoNHjo X-Received: by 2002:a05:6a20:daa5:b0:1af:593a:c820 with SMTP id adf61e73a8af0-1afbdd31b8bmr5211650637.31.1715116462359; Tue, 07 May 2024 14:14:22 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715116462; cv=pass; d=google.com; s=arc-20160816; b=k3dfcdxUdcjmzC3w3R/WkF7jPwj8tly4EbRzrRj41dwmPu5O0MbXuz+65mp5zn9ao3 8xiztm+PbEJJwd9goqATaFx3/sKwqXTXELihES62CylMN907HktgbLppwqyHIH1aS0RQ ZXPLo8uBNFtSeBH2SvAA29/Rpzm61wB9bnrJLAA7juMFXsOVLsk8i/7knuYoN9/8OyZ5 nWM7Gtd9ufuWmwU9UQIiA3440TH1BZBvdLOQ1PVgRG3fQpFEcEkwTRzk1VColLlR/J0X cWhIEL5AANSjl8EJfHxNsSUlk5CP0xuOQX/o0ieYZBckJ7hy5QC5J+lTiJJ6Wd4/8OSp 33Xg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-disposition:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:message-id:subject:cc:to:from:date :dkim-signature; bh=qYFrxhuTIrqrxFkifa4GjWEZBcYt9ZP/lSNrLelrdGg=; fh=3NciTkDiVxyGkREpGZXNnP3IvYF/jYeZfheSJGrVtNs=; b=LmwC6gilftI+2wh4fwpGQjx9hZhV8s4daxUotTNp4RlEl8nkUCkBP+cQyMijOz2hay a7+iR7Gro9/z713N9pHR+n4T4fWu4O7VDQKQP35TS/0ckQKKzQDV5NEmvrm5zIpQsIiP R3Ov43ZlAmFrJD3tQH+Ksz75JyGVDx5PVWsolFzRt/SwZfskJl81E6ewJZSxbbVx4jOy EDXXS6zEMb4fmHWw9SD8YYoADbenbbh5/TXTduk9ZS59azA/n2OmeRg+8KLX9fX9v4wU yX6m+jSSEjleQenlxeZZ8hqvHCrnLb4rLhaKHsDa+sQvJj/Fzs3jWKSZUlRquuzr3Tf3 R7YA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=LQyzNymN; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-172210-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-172210-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id h127-20020a636c85000000b005f7fcf8cddbsi10545571pgc.831.2024.05.07.14.14.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 May 2024 14:14:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-172210-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=LQyzNymN; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-172210-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-172210-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 562C8280F93 for ; Tue, 7 May 2024 21:14:13 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 19DD514B94F; Tue, 7 May 2024 21:14:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="LQyzNymN" Received: from mail-wm1-f53.google.com (mail-wm1-f53.google.com [209.85.128.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AA69B71B5C; Tue, 7 May 2024 21:13:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.53 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715116439; cv=none; b=WRTehTHsK0aD1JfR5HsFUywR8CBT5aBABd4giqji51wNG8ZoLa8XL6BqRluyuvA/lvbRChwhMEuvJWLczDDkIk55+6ovmqkylFAbQzmZZ09MCKLHs1AJ9eixM7CRMzL53EtGtpVaawcqLg1BWcVDEsPS50sOaFCQ2CK4vE+96TI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715116439; c=relaxed/simple; bh=tniya1MI4D0E7HadkP5SUtQrULgRW0O5FJAB2XEqmEk=; h=Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition; b=B1Jzlp4PV8lAVo4GT8ImYrjyCLY5v1NtY/01STC1cNK2TljH8IB3YIkXTdEDSNsa0xgjSGX0I97qfv0eVMQJuadrZsIHo6klgL1idn3p/COkLLkJDtAelYpUi6Gfm787VtRHeue53t3vzNslTSfEAwLjKQIe0u9P+of6j7rF7a4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=LQyzNymN; arc=none smtp.client-ip=209.85.128.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wm1-f53.google.com with SMTP id 5b1f17b1804b1-41b794510cdso29088555e9.2; Tue, 07 May 2024 14:13:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715116436; x=1715721236; darn=vger.kernel.org; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :from:to:cc:subject:date:message-id:reply-to; bh=qYFrxhuTIrqrxFkifa4GjWEZBcYt9ZP/lSNrLelrdGg=; b=LQyzNymNK+erV42jMaew+eG3zqUYAEMjatIONDhy2spcH0kUJHLueQqJO9f1DkZrtA HTK2hXaspAGTgnWjFKJbvuUtiLY/GoKWJmrQJYlHw0wehp5Y888/AX2NTgCSMRkCezTH n1z0RpuH8otfDd7cgJb6mNYGy14i8LxViS2Z1cQ6w+h21f+cGqODcG+U5FefGWki5uDW oHl+6dkkR4LhxD6F46xGGJmnpHF8z/QSJQSMzLt4xrTKudHqy6rnIVPPxh/lbTGFEcHA TILH9MxsZC5M+18YLUAM3Ph72e2fsiI3LqNHL9K6psmQtC2tUPZXTSRs1HyMpEp2HGpG /pbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715116436; x=1715721236; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=qYFrxhuTIrqrxFkifa4GjWEZBcYt9ZP/lSNrLelrdGg=; b=vfVRaBuQ+sqmCUyrZ3pWy/JxKEysdYAd4g6PeNBUgy3DF0uK69HY+am+0q+uy/+zJO PvXRP9HXusuTcu6BaT+xkZbrM1WgauK2nKwxCxecdJHyE3YgTJucDzmvRG1GZiuNKeqq BE0kRNa2TKJae/7gAgM1tv553DVimlO7SpRN9aKtWEhuLX5+DZku/1C5LJwps0/2SM1B /PsSAoQ72DK++j5Mh+1AQ7TMhF9+t9dLk+e2JGx5U+IRIX2dfoz5PONP8LWqK4SNrAqZ 2BOiiUlnTlEjfdk7aOrdKBgSRrax17zGGvPIm/KeUYA+QfvXqaS9X6wA4sdv8qs42fEk ftZg== X-Forwarded-Encrypted: i=1; AJvYcCUn1KhRbjD7reLYcKJ6xm13IESPZxw58lkQUZOOP7M/JnQHs3PtxWrrJDYGN3tILcUmsQpa2U/l+F/OMShyT87i/x2KW7HNN/Ju9slJR6MQRd0m8PgmNxT1b5wfKIxikKrkzoSgXeEmYg== X-Gm-Message-State: AOJu0Yy79IYaw6kjOPwhLGvY3PBJgDtV77b+7hxHDgVCO1T2W17yeD2v gcLt5pRG5XuIlOoNlNGp97BybDEA6lp5R/BEdO0fjSTuIvWb1ocjPtuX/Vc= X-Received: by 2002:a05:600c:3d99:b0:41c:258:9b70 with SMTP id 5b1f17b1804b1-41f719d62d3mr6907085e9.28.1715116435248; Tue, 07 May 2024 14:13:55 -0700 (PDT) Received: from octinomon.home (182.179.147.147.dyn.plus.net. [147.147.179.182]) by smtp.gmail.com with ESMTPSA id p9-20020a05600c1d8900b0041563096e15sm24808106wms.5.2024.05.07.14.13.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 May 2024 14:13:54 -0700 (PDT) Date: Tue, 7 May 2024 22:13:52 +0100 From: Jules Irenge To: dengler@linux.ibm.com, svens@linux.ibm.com Cc: borntraeger@linux.ibm.com, agordeev@linux.ibm.com, hca@linux.ibm.com, freude@linux.ibm.com, linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3] s390/pkey: use kfree_sensitive() to fix Coccinelle warnings Message-ID: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Replace memzero_explicit() and kfree() with kfree_sentive() to fix warnings reported by Coccinelle WARNING opportunity for kfree_sensitive/kvfree_sensitive (line 1506) WARNING opportunity for kfree_sensitive/kvfree_sensitive (line 1643) WARNING opportunity for kfree_sensitive/kvfree_sensitive (line 1770) Signed-off-by: Jules Irenge --- Changes in v3: - use kfree_sensitive() instead of kvfree_sensitive as a correction drivers/s390/crypto/pkey_api.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/s390/crypto/pkey_api.c b/drivers/s390/crypto/pkey_api.c index dccf664a3d95..933894065623 100644 --- a/drivers/s390/crypto/pkey_api.c +++ b/drivers/s390/crypto/pkey_api.c @@ -1503,8 +1503,7 @@ static long pkey_unlocked_ioctl(struct file *filp, unsigned int cmd, rc = pkey_keyblob2pkey(kkey, ktp.keylen, ktp.protkey.protkey, &ktp.protkey.len, &ktp.protkey.type); pr_debug("%s pkey_keyblob2pkey()=%d\n", __func__, rc); - memzero_explicit(kkey, ktp.keylen); - kfree(kkey); + kfree_sensitive(kkey); if (rc) break; if (copy_to_user(utp, &ktp, sizeof(ktp))) @@ -1640,8 +1639,7 @@ static long pkey_unlocked_ioctl(struct file *filp, unsigned int cmd, &ktp.protkey.type); pr_debug("%s pkey_keyblob2pkey2()=%d\n", __func__, rc); kfree(apqns); - memzero_explicit(kkey, ktp.keylen); - kfree(kkey); + kfree_sensitive(kkey); if (rc) break; if (copy_to_user(utp, &ktp, sizeof(ktp))) @@ -1767,8 +1765,7 @@ static long pkey_unlocked_ioctl(struct file *filp, unsigned int cmd, protkey, &protkeylen, &ktp.pkeytype); pr_debug("%s pkey_keyblob2pkey3()=%d\n", __func__, rc); kfree(apqns); - memzero_explicit(kkey, ktp.keylen); - kfree(kkey); + kfree_sensitive(kkey); if (rc) { kfree(protkey); break; -- 2.43.2