Patch "x86/resctrl: Fix a NULL vs IS_ERR() static checker warning in rdt_cdp_peer_get()" has been added to the 4.19-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

    x86/resctrl: Fix a NULL vs IS_ERR() static checker warning in rdt_cdp_peer_get()

to the 4.19-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:
     x86-resctrl-fix-a-null-vs-is_err-static-checker-warn.patch
and it can be found in the queue-4.19 subdirectory.

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



commit 8361b99aea414a3328c5dfa87e31b86ba88b8fb9
Author: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
Date:   Tue Jun 2 22:36:11 2020 +0300

    x86/resctrl: Fix a NULL vs IS_ERR() static checker warning in rdt_cdp_peer_get()
    
    [ Upstream commit cc5277fe66cf3ad68f41f1c539b2ef0d5e432974 ]
    
    The callers don't expect *d_cdp to be set to an error pointer, they only
    check for NULL.  This leads to a static checker warning:
    
      arch/x86/kernel/cpu/resctrl/rdtgroup.c:2648 __init_one_rdt_domain()
      warn: 'd_cdp' could be an error pointer
    
    This would not trigger a bug in this specific case because
    __init_one_rdt_domain() calls it with a valid domain that would not have
    a negative id and thus not trigger the return of the ERR_PTR(). If this
    was a negative domain id then the call to rdt_find_domain() in
    domain_add_cpu() would have returned the ERR_PTR() much earlier and the
    creation of the domain with an invalid id would have been prevented.
    
    Even though a bug is not triggered currently the right and safe thing to
    do is to set the pointer to NULL because that is what can be checked for
    when the caller is handling the CDP and non-CDP cases.
    
    Fixes: 52eb74339a62 ("x86/resctrl: Fix rdt_find_domain() return value and checks")
    Signed-off-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
    Signed-off-by: Borislav Petkov <bp@xxxxxxx>
    Acked-by: Reinette Chatre <reinette.chatre@xxxxxxxxx>
    Acked-by: Fenghua Yu <fenghua.yu@xxxxxxxxx>
    Link: https://lkml.kernel.org/r/20200602193611.GA190851@mwanda
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c b/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c
index cea7e01a346d3..e62e416dd1162 100644
--- a/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c
+++ b/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c
@@ -1035,6 +1035,7 @@ static int rdt_cdp_peer_get(struct rdt_resource *r, struct rdt_domain *d,
 	_d_cdp = rdt_find_domain(_r_cdp, d->id, NULL);
 	if (WARN_ON(IS_ERR_OR_NULL(_d_cdp))) {
 		_r_cdp = NULL;
+		_d_cdp = NULL;
 		ret = -EINVAL;
 	}
 



[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