Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp762243ybt; Fri, 19 Jun 2020 13:06:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyBp2t/ACiOPOtpJrYXD9JbuEQRTeh6uNYuN6z39UcEHP9kKDjNICl7jjKi1e3Ygyc9yZ+g X-Received: by 2002:a05:6402:1b01:: with SMTP id by1mr5015520edb.20.1592597193280; Fri, 19 Jun 2020 13:06:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592597193; cv=none; d=google.com; s=arc-20160816; b=siuEQCsMItE5hoynSXKqvRKznjdRvCVAPiHl4+XB3o5Px7Ucj+X2jeKecVKPSDxN2n cpuDyQzM8eaXv8kZ+BVvSgmMyJI25kXoa/ccquehC/FXuBN3JdsOWmr0V3cEwi+ihgL+ 5qtwYqc7ezuUYA6gv9WvTCWTx9cH4j/pB+BRizA4fn/lcyfqlsbKGZHTsNokxQO2FFIi mG4sNoS/3DoreNYj9iL0rkk1GGckK0R/oZ60Kk3lSE7kxvI6qHVYq9PFo9F2fD+hatkL dJD81cT6twL71Zi2RDlnmDmXe/JfIXxqBqD4tGSjwhS0Y8/5nLnlZGCIeufgF6APFcaJ PSZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=eNtFqz2yP1dbULOfSsoeBPHOePq4CvYoDVbpiowUChE=; b=FqMD5mFmu5jBtex1S8IbTM5XxH/ail4T+uSfTvm0L62G5FS0+eHOPA/DwnYmfAckPd 9yLN02BpaLWgovZm884bekpqgufK/Bu20v1wuKEo4DwX0wZ7Y2jd1NxRT8RpCBmrW9Fc uRkw6uecHFlxuA6vcP941Tg2qcsmecxcdW/P3jkVjfbbmr1iXGqveDBKgzKV1bQXBmni pZKb08JZF6SGBREaEv5fhK+16b+rwPOZ6+7sMfHA9sqYP6wfkRv7KDkdIBV42nok+LWp uST22wz23Q4ISXdVYzXq9L0cNyMs7hkdM8lMtwzmjZ7wHYRO+ojaQr1nDh5RSzmJUEv8 Cn5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=PejAPDsu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d16si4402514eja.32.2020.06.19.13.06.11; Fri, 19 Jun 2020 13:06:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=PejAPDsu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389931AbgFSOzH (ORCPT + 99 others); Fri, 19 Jun 2020 10:55:07 -0400 Received: from mail.kernel.org ([198.145.29.99]:49846 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389924AbgFSOzF (ORCPT ); Fri, 19 Jun 2020 10:55:05 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B14D821556; Fri, 19 Jun 2020 14:55:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592578505; bh=w0pont9YxTvzq6A02FpwioLyzwEFmcqCrB0EfSaeds8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PejAPDsuDi28jMqefeibj0nd4/WkzecNGItUuc3aYJc/PCRnbzWunR+ol91xt5HC3 qVs+iFaXSyRAEgg9MW5nGR4cPnJzLUq25MuzR7Am9bAxSh6h3cU7CrJrKNTACVGafO dVbNlDY502MZ+4QNZkVuiS9vWxxbwV28v7Fr09lc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe JAILLET , Herbert Xu Subject: [PATCH 4.19 047/267] crypto: cavium/nitrox - Fix nitrox_get_first_device() when ndevlist is fully iterated Date: Fri, 19 Jun 2020 16:30:32 +0200 Message-Id: <20200619141651.147958843@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200619141648.840376470@linuxfoundation.org> References: <20200619141648.840376470@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Christophe JAILLET commit 320bdbd816156f9ca07e5fed7bfb449f2908dda7 upstream. When a list is completely iterated with 'list_for_each_entry(x, ...)', x is not NULL at the end. While at it, remove a useless initialization of the ndev variable. It is overridden by 'list_for_each_entry'. Fixes: f2663872f073 ("crypto: cavium - Register the CNN55XX supported crypto algorithms.") Cc: Signed-off-by: Christophe JAILLET Signed-off-by: Herbert Xu Signed-off-by: Greg Kroah-Hartman --- drivers/crypto/cavium/nitrox/nitrox_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/crypto/cavium/nitrox/nitrox_main.c +++ b/drivers/crypto/cavium/nitrox/nitrox_main.c @@ -183,7 +183,7 @@ static void nitrox_remove_from_devlist(s struct nitrox_device *nitrox_get_first_device(void) { - struct nitrox_device *ndev = NULL; + struct nitrox_device *ndev; mutex_lock(&devlist_lock); list_for_each_entry(ndev, &ndevlist, list) { @@ -191,7 +191,7 @@ struct nitrox_device *nitrox_get_first_d break; } mutex_unlock(&devlist_lock); - if (!ndev) + if (&ndev->list == &ndevlist) return NULL; refcount_inc(&ndev->refcnt);