arch/xtensa: espressif: temperature: Fix incorrect pointer casting
Fix bug in temperature sensor driver where direct casting of lower half structure pointer could lead to incorrect memory access. Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
This commit is contained in:
parent
106058cc1f
commit
47e4576b1c
1 changed files with 4 additions and 2 deletions
|
|
@ -713,7 +713,8 @@ static int esp_temperature_sensor_set_interval(
|
||||||
struct file *filep,
|
struct file *filep,
|
||||||
uint32_t *period_us)
|
uint32_t *period_us)
|
||||||
{
|
{
|
||||||
struct esp_temp_priv_s *priv = (struct esp_temp_priv_s *)lower;
|
struct esp_temp_priv_s *priv =
|
||||||
|
container_of(lower, struct esp_temp_priv_s, lower);
|
||||||
|
|
||||||
if (*period_us < ESP_TEMP_MIN_INTERVAL)
|
if (*period_us < ESP_TEMP_MIN_INTERVAL)
|
||||||
{
|
{
|
||||||
|
|
@ -752,7 +753,8 @@ static int esp_temperature_sensor_activate(
|
||||||
struct file *filep,
|
struct file *filep,
|
||||||
bool enable)
|
bool enable)
|
||||||
{
|
{
|
||||||
struct esp_temp_priv_s *priv = (struct esp_temp_priv_s *)lower;
|
struct esp_temp_priv_s *priv =
|
||||||
|
container_of(lower, struct esp_temp_priv_s, lower);
|
||||||
#ifdef CONFIG_ESPRESSIF_TEMP_UORB_POLL
|
#ifdef CONFIG_ESPRESSIF_TEMP_UORB_POLL
|
||||||
bool start_thread = false;
|
bool start_thread = false;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue