Patch "PM: domains: fix integer overflow issues in genpd_parse_state()" has been added to the 5.4-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

    PM: domains: fix integer overflow issues in genpd_parse_state()

to the 5.4-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:
     pm-domains-fix-integer-overflow-issues-in-genpd_pars.patch
and it can be found in the queue-5.4 subdirectory.

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



commit dbaf9f92815b85a8f4615e155ec975e17a19d3db
Author: Nikita Zhandarovich <n.zhandarovich@xxxxxxxxxx>
Date:   Tue Apr 18 06:07:43 2023 -0700

    PM: domains: fix integer overflow issues in genpd_parse_state()
    
    [ Upstream commit e5d1c8722083f0332dcd3c85fa1273d85fb6bed8 ]
    
    Currently, while calculating residency and latency values, right
    operands may overflow if resulting values are big enough.
    
    To prevent this, albeit unlikely case, play it safe and convert
    right operands to left ones' type s64.
    
    Found by Linux Verification Center (linuxtesting.org) with static
    analysis tool SVACE.
    
    Fixes: 30f604283e05 ("PM / Domains: Allow domain power states to be read from DT")
    Signed-off-by: Nikita Zhandarovich <n.zhandarovich@xxxxxxxxxx>
    Acked-by: Ulf Hansson <ulf.hansson@xxxxxxxxxx>
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@xxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
index edb791354421b..5be76197bc361 100644
--- a/drivers/base/power/domain.c
+++ b/drivers/base/power/domain.c
@@ -2596,10 +2596,10 @@ static int genpd_parse_state(struct genpd_power_state *genpd_state,
 
 	err = of_property_read_u32(state_node, "min-residency-us", &residency);
 	if (!err)
-		genpd_state->residency_ns = 1000 * residency;
+		genpd_state->residency_ns = 1000LL * residency;
 
-	genpd_state->power_on_latency_ns = 1000 * exit_latency;
-	genpd_state->power_off_latency_ns = 1000 * entry_latency;
+	genpd_state->power_on_latency_ns = 1000LL * exit_latency;
+	genpd_state->power_off_latency_ns = 1000LL * entry_latency;
 	genpd_state->fwnode = &state_node->fwnode;
 
 	return 0;



[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