mirror of
https://github.com/torvalds/linux.git
synced 2026-05-31 02:24:24 +02:00
drm/i915/display: Fix possible overflow on tc power domain selection
There is a possibility that intel_encoder_to_tc() function returns negative i.e. TC_PORT_NONE (-1) value which may cause tc_port_power_domain() function to overflow. To fix this, let's add additional check that returns invalid power domain i.e. POWER_DOMAIN_INVALID in case tc port equals TC_PORT_NONE. Signed-off-by: Mika Kahola <mika.kahola@intel.com> Reviewed-by: Suraj Kandpal <suraj.kandpal@intel.com> Link: https://lore.kernel.org/r/20250829101226.4085757-1-mika.kahola@intel.com
This commit is contained in:
parent
5f9bab8081
commit
765531faa4
|
|
@ -249,6 +249,9 @@ tc_port_power_domain(struct intel_tc_port *tc)
|
|||
{
|
||||
enum tc_port tc_port = intel_encoder_to_tc(&tc->dig_port->base);
|
||||
|
||||
if (tc_port == TC_PORT_NONE)
|
||||
return POWER_DOMAIN_INVALID;
|
||||
|
||||
return POWER_DOMAIN_PORT_DDI_LANES_TC1 + tc_port - TC_PORT_1;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user