From patchwork Fri Jun 19 14:30:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 224201 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2CB12C433E0 for ; Fri, 19 Jun 2020 14:55:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0364421919 for ; Fri, 19 Jun 2020 14:55:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592578508; bh=w0pont9YxTvzq6A02FpwioLyzwEFmcqCrB0EfSaeds8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=2k50VNAhXVfVqYFefsvOQdb0m5r/ypbm6jUcxrjhl3PSHE9cj2h2sidb2eWkZ9Gru naKIyelT18VykXMGLuyu03m8tGQS5F2Y1Q4bRpURE7EDInMswbv0yRqOYov7VbPw/X zAAFxdzILU2ArUV7saLdU7LXz32NMG8x2ISsdWj0= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389928AbgFSOzG (ORCPT ); Fri, 19 Jun 2020 10:55:06 -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 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@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);