Patch "powerpc/sysdev: fix incorrect use to determine if list is empty" has been added to the 5.15-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    powerpc/sysdev: fix incorrect use to determine if list is empty

to the 5.15-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     powerpc-sysdev-fix-incorrect-use-to-determine-if-lis.patch
and it can be found in the queue-5.15 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit ea2e2b75c0b2981f97ad16fa3b8f545a0772de11
Author: Jakob Koschel <jakobkoschel@xxxxxxxxx>
Date:   Mon Feb 28 15:24:33 2022 +0100

    powerpc/sysdev: fix incorrect use to determine if list is empty
    
    [ Upstream commit fa1321b11bd01752f5be2415e74a0e1a7c378262 ]
    
    'gtm' will *always* be set by list_for_each_entry().
    It is incorrect to assume that the iterator value will be NULL if the
    list is empty.
    
    Instead of checking the pointer it should be checked if
    the list is empty.
    
    Fixes: 83ff9dcf375c ("powerpc/sysdev: implement FSL GTM support")
    Signed-off-by: Jakob Koschel <jakobkoschel@xxxxxxxxx>
    Signed-off-by: Michael Ellerman <mpe@xxxxxxxxxxxxxx>
    Link: https://lore.kernel.org/r/20220228142434.576226-1-jakobkoschel@xxxxxxxxx
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/arch/powerpc/sysdev/fsl_gtm.c b/arch/powerpc/sysdev/fsl_gtm.c
index 8963eaffb1b7..39186ad6b3c3 100644
--- a/arch/powerpc/sysdev/fsl_gtm.c
+++ b/arch/powerpc/sysdev/fsl_gtm.c
@@ -86,7 +86,7 @@ static LIST_HEAD(gtms);
  */
 struct gtm_timer *gtm_get_timer16(void)
 {
-	struct gtm *gtm = NULL;
+	struct gtm *gtm;
 	int i;
 
 	list_for_each_entry(gtm, &gtms, list_node) {
@@ -103,7 +103,7 @@ struct gtm_timer *gtm_get_timer16(void)
 		spin_unlock_irq(&gtm->lock);
 	}
 
-	if (gtm)
+	if (!list_empty(&gtms))
 		return ERR_PTR(-EBUSY);
 	return ERR_PTR(-ENODEV);
 }



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux