Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp2115274rdb; Thu, 7 Dec 2023 20:34:25 -0800 (PST) X-Google-Smtp-Source: AGHT+IFzRgjCV1Wua27N2eezratGfrYzRKhwy1/iLjS28e1YM/ChnLiGKaYodEw5KV+s98t9HBaJ X-Received: by 2002:a05:6871:5306:b0:1fa:fe81:2fd with SMTP id hx6-20020a056871530600b001fafe8102fdmr5084106oac.33.1702010065068; Thu, 07 Dec 2023 20:34:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702010065; cv=none; d=google.com; s=arc-20160816; b=jguh/mznXhkyFk+bXWvVpf4GUeT9x32mmUgi5YjZqg54T4KbiaPw3PMsiiQqksr2IA +AO2mm/RcuxyLU7cFKCn6uICwYsRdUyW2I8rfw5S3ZfFhN6h08dgo4dMjpu5wRg/l8Tk k7z9VEv97KRRB4t0a2/lOCPO/0KHf68UJB7OMVNm3SUORE7EyzjnkdslVQuiSbEjo1UH G2v3478VQGu3CmIW5mWOrjVmFEAp69K6Tb050jYgDVA+8ris6gDApk0kQF7QWv9N7EE+ PVSUjNQ9slhAx9pYcoxklblM5vaAeIQdClPPKzLtiRswwI6LU6A/UBuZdBwtsJK1kmQ8 DCFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date; bh=tyCLQeJSPq+NkZBGURZyy/dL1U0r5hpirAY6xLC7Fbs=; fh=PB6GsYlD3cbqnbFg2H8cloOOHzFDE3K0Qq/bTXkyCbo=; b=DRzcvsV1d3gEHO/bEos2J0O1L1pk1CYykBLbjIgks7tNMDcHgYZ+/bQ0NotgD8sRPl ix7cKLqUtGlNGOsxXsZvxckPamI+a5lGEAemIT1aoSH8BktN7XlzmbXgt2iN/HsziNwQ p7GWSsgy1h7rGbAlaJyCYTZGYj9g6cUIdJ8l2gXVJDtIT+GyhBw94wNhDwTmyM/oHzw+ HPrlMy3zILga8utSiDv7k2Tv9wKMjzJLnGntenqF+4BQh65y6s/fBXFSDd5wz3jcbMix 4gL7MGIG6ZMpe59BM9D37IjjC8dk0q/FJPlwRQcJF73Mp4jx5qS9XV2bCWpDS8herUVR 7g7w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-crypto+bounces-634-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-crypto+bounces-634-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id p1-20020a63fe01000000b005c68b6c6b82si834828pgh.747.2023.12.07.20.34.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Dec 2023 20:34:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-crypto+bounces-634-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-crypto+bounces-634-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-crypto+bounces-634-linux.lists.archive=gmail.com@vger.kernel.org" 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 B7357281D93 for ; Fri, 8 Dec 2023 04:34:24 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7B5845668 for ; Fri, 8 Dec 2023 04:34:24 +0000 (UTC) X-Original-To: linux-crypto@vger.kernel.org Received: from abb.hmeau.com (abb.hmeau.com [144.6.53.87]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C309B1715 for ; Thu, 7 Dec 2023 20:07:24 -0800 (PST) Received: from loth.rohan.me.apana.org.au ([192.168.167.2]) by formenos.hmeau.com with smtp (Exim 4.94.2 #2 (Debian)) id 1rBS92-008IiG-1K; Fri, 08 Dec 2023 12:07:21 +0800 Received: by loth.rohan.me.apana.org.au (sSMTP sendmail emulation); Fri, 08 Dec 2023 12:07:29 +0800 Date: Fri, 8 Dec 2023 12:07:29 +0800 From: Herbert Xu To: Damian Muszynski Cc: linux-crypto@vger.kernel.org, qat-linux@intel.com, Dan Carpenter , Giovanni Cabiddu Subject: Re: [PATCH] crypto: qat - fix error path in add_update_sla() Message-ID: References: <20231128173828.84083-1-damian.muszynski@intel.com> Precedence: bulk X-Mailing-List: linux-crypto@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231128173828.84083-1-damian.muszynski@intel.com> On Tue, Nov 28, 2023 at 06:37:32PM +0100, Damian Muszynski wrote: > The input argument `sla_in` is a pointer to a structure that contains > the parameters of the SLA which is being added or updated. > If this pointer is NULL, the function should return an error as > the data required for the algorithm is not available. > By mistake, the logic jumps to the error path which dereferences > the pointer. > > This results in a warnings reported by the static analyzer Smatch when > executed without a database: > > drivers/crypto/intel/qat/qat_common/adf_rl.c:871 add_update_sla() > error: we previously assumed 'sla_in' could be null (see line 812) > > This issue was not found in internal testing as the pointer cannot be > NULL. The function add_update_sla() is only called (indirectly) by > the rate limiting sysfs interface implementation in adf_sysfs_rl.c > which ensures that the data structure is allocated and valid. This is > also proven by the fact that Smatch executed with a database does not > report such error. > > Fix it by returning with error if the pointer `sla_in` is NULL. > > Fixes: d9fb8408376e ("crypto: qat - add rate limiting feature to qat_4xxx") > Reported-by: Dan Carpenter > Signed-off-by: Damian Muszynski > Reviewed-by: Giovanni Cabiddu > --- > drivers/crypto/intel/qat/qat_common/adf_rl.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) Patch applied. Thanks. -- Email: Herbert Xu Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt