Skip to content

Commit 9c96808

Browse files
tititiou36ij-intel
authored andcommitted
thermal/drivers/acerhdf: Constify struct thermal_zone_device_ops
'struct thermal_zone_device_ops' could be left unmodified in this driver. Constifying this structure moves some data to a read-only section, so increases overall security, especially when the structure holds some function pointers. While at it, also constify a struct thermal_zone_params. On a x86_64, with allmodconfig: Before: ====== text data bss dec hex filename 26422 12584 512 39518 9a5e drivers/platform/x86/acerhdf.o After: ===== text data bss dec hex filename 26646 12360 512 39518 9a5e drivers/platform/x86/acerhdf.o Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Link: https://lore.kernel.org/r/e502fadf2c6b24fc4ec3a7880533f7ca68429720.1748177235.git.christophe.jaillet@wanadoo.fr Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
1 parent 69157b0 commit 9c96808

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/platform/x86/acerhdf.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ static const struct bios_settings bios_tbl[] __initconst = {
271271
* this struct is used to instruct thermal layer to use bang_bang instead of
272272
* default governor for acerhdf
273273
*/
274-
static struct thermal_zone_params acerhdf_zone_params = {
274+
static const struct thermal_zone_params acerhdf_zone_params = {
275275
.governor_name = "bang_bang",
276276
};
277277

@@ -426,7 +426,7 @@ static int acerhdf_get_crit_temp(struct thermal_zone_device *thermal,
426426
}
427427

428428
/* bind callback functions to thermalzone */
429-
static struct thermal_zone_device_ops acerhdf_dev_ops = {
429+
static const struct thermal_zone_device_ops acerhdf_dev_ops = {
430430
.should_bind = acerhdf_should_bind,
431431
.get_temp = acerhdf_get_ec_temp,
432432
.change_mode = acerhdf_change_mode,

0 commit comments

Comments
 (0)