mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-09 06:43:09 +00:00
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: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
This commit is contained in:
parent
2ef9a1e722
commit
73a4385c69
@ -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
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user