Skip to content

Conversation

@stschake
Copy link

@stschake stschake commented Apr 5, 2025

to_camera_common_data() actually parses the DT again and will return NULL if no sensor modes are defined. In this case it is unsafe to dereference the return value without previously checking for NULL.

I have a HDMI-CSI bridge chip used in parallel that doesn't define any sensor modes (since its only figured out at runtime), and the VC-MIPI changes were causing crashes. Sorry I didn't have a good setup to modify the patches properly, so it's inline.

For reference, to_camera_common_data from nvidia-oot/include/media/camera_common.h:

static inline struct camera_common_data *to_camera_common_data(
        const struct device *dev)
{
        if (sensor_common_parse_num_modes(dev))
                return container_of(dev_get_drvdata(dev),
                    struct camera_common_data, subdev);
        return NULL;
}

to_camera_common_data() actually parses the DT again and will return
NULL if no sensor modes are defined. In this case it is unsafe to
dereference the return value without previously checking for NULL.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant