[PATCH] powerpc/windfarm: don't pass const strings to snprintf
David Laight
David.Laight at ACULAB.COM
Thu May 3 20:35:48 EST 2012
> --- a/drivers/macintosh/windfarm_smu_sat.c
> +++ b/drivers/macintosh/windfarm_smu_sat.c
> @@ -287,7 +287,7 @@ static int wf_sat_probe(struct i2c_client *client,
> sens->sat = sat;
> sens->sens.ops = &wf_sat_ops;
> sens->sens.name = (char *) (sens + 1);
> - snprintf(sens->sens.name, 16, "%s-%d", name, cpu);
> + snprintf((char *)sens->sens.name, 16, "%s-%d", name,
cpu);
>
> if (wf_register_sensor(&sens->sens))
> kfree(sens);
Wouldn't it be better to do:
snprintf((char *)(sens + 1), 16, "%s-%d", name, cpu);
David
More information about the Linuxppc-dev
mailing list