linux-stable/drivers/hwtracing
Dan Carpenter d0c80f48fb coresight: Fix signedness bug in tmc_etr_buf_insert_barrier_packet()
commit f67bc15e52 upstream.

This code generates a Smatch warning:

    drivers/hwtracing/coresight/coresight-tmc-etr.c:947 tmc_etr_buf_insert_barrier_packet()
    error: uninitialized symbol 'bufp'.

The problem is that if tmc_sg_table_get_data() returns -EINVAL, then
when we test if "len < CORESIGHT_BARRIER_PKT_SIZE", the negative "len"
value is type promoted to a high unsigned long value which is greater
than CORESIGHT_BARRIER_PKT_SIZE.  Fix this bug by adding an explicit
check for error codes.

Fixes: 75f4e3619f ("coresight: tmc-etr: Add transparent buffer management")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Link: https://lore.kernel.org/r/7d33e244-d8b9-4c27-9653-883a13534b01@kili.mountain
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-05-30 12:42:15 +01:00
..
coresight coresight: Fix signedness bug in tmc_etr_buf_insert_barrier_packet() 2023-05-30 12:42:15 +01:00
intel_th intel_th: pci: Add Meteor Lake-P support 2022-08-25 11:15:30 +02:00
stm stm class: Fix module init return on allocation failure 2021-01-27 11:05:40 +01:00
Kconfig hwtracing: Add HW tracing support menu 2018-03-29 13:38:10 +03:00