Commit 73a4385c authored by Laurent Pinchart's avatar Laurent Pinchart Committed by Hans Verkuil

media: vimc: Constify vimc_ent_type structures

The vimc_ent_type structure contains static pointers to functions, and
no other information that need to be modified after initialization. Make
them const to avoid the risk of arbitrary code execution following an
overflow that would overwrite the structure's contents.
Signed-off-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: default avatarShuah Khan <skhan@linuxfoundation.org>
Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
parent 2ef9a1e7
......@@ -494,7 +494,7 @@ static struct vimc_ent_device *vimc_capture_add(struct vimc_device *vimc,
return ERR_PTR(ret);
}
struct vimc_ent_type vimc_capture_type = {
const struct vimc_ent_type vimc_capture_type = {
.add = vimc_capture_add,
.unregister = vimc_capture_unregister,
.release = vimc_capture_release
......
......@@ -156,7 +156,7 @@ struct vimc_ent_type {
*/
struct vimc_ent_config {
const char *name;
struct vimc_ent_type *type;
const struct vimc_ent_type *type;
};
/**
......@@ -167,11 +167,11 @@ struct vimc_ent_config {
*/
bool vimc_is_source(struct media_entity *ent);
extern struct vimc_ent_type vimc_sensor_type;
extern struct vimc_ent_type vimc_debayer_type;
extern struct vimc_ent_type vimc_scaler_type;
extern struct vimc_ent_type vimc_capture_type;
extern struct vimc_ent_type vimc_lens_type;
extern const struct vimc_ent_type vimc_sensor_type;
extern const struct vimc_ent_type vimc_debayer_type;
extern const struct vimc_ent_type vimc_scaler_type;
extern const struct vimc_ent_type vimc_capture_type;
extern const struct vimc_ent_type vimc_lens_type;
/**
* vimc_pix_map_by_index - get vimc_pix_map struct by its index
......
......@@ -622,7 +622,7 @@ static struct vimc_ent_device *vimc_debayer_add(struct vimc_device *vimc,
return ERR_PTR(ret);
}
struct vimc_ent_type vimc_debayer_type = {
const struct vimc_ent_type vimc_debayer_type = {
.add = vimc_debayer_add,
.release = vimc_debayer_release
};
......@@ -96,7 +96,7 @@ static void vimc_lens_release(struct vimc_ent_device *ved)
kfree(vlens);
}
struct vimc_ent_type vimc_lens_type = {
const struct vimc_ent_type vimc_lens_type = {
.add = vimc_lens_add,
.release = vimc_lens_release
};
......@@ -442,7 +442,7 @@ static struct vimc_ent_device *vimc_scaler_add(struct vimc_device *vimc,
return &vscaler->ved;
}
struct vimc_ent_type vimc_scaler_type = {
const struct vimc_ent_type vimc_scaler_type = {
.add = vimc_scaler_add,
.release = vimc_scaler_release
};
......@@ -448,7 +448,7 @@ static struct vimc_ent_device *vimc_sensor_add(struct vimc_device *vimc,
return ERR_PTR(ret);
}
struct vimc_ent_type vimc_sensor_type = {
const struct vimc_ent_type vimc_sensor_type = {
.add = vimc_sensor_add,
.release = vimc_sensor_release
};
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment