mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] state: fix range check on uint8 and uint32 variables
@ 2015-07-03 14:07 Marc Kleine-Budde
  2015-07-03 14:08 ` Marc Kleine-Budde
  2015-07-03 14:16 ` Marc Kleine-Budde
  0 siblings, 2 replies; 3+ messages in thread
From: Marc Kleine-Budde @ 2015-07-03 14:07 UTC (permalink / raw)
  To: barebox; +Cc: sha

The patch "8bfd06f073c8 state: uint8: add range check for uint8" as applied not
correctly to the repository. It was supposed to change the state_uint8_create()
function:

|  static struct state_variable *state_uint8_create(struct state *state,
|
|  	su32 = xzalloc(sizeof(*su32));
|
| -	param = dev_add_param_int(&state->dev, name, state_set_dirty,
| -				  NULL, &su32->value, "%u", state);
| +	param = dev_add_param_int(&state->dev, name, state_uint8_set,
| +				  NULL, &su32->value, "%u", su32);

but the state_uint32_create() was changed instead, which leads to broken range
checks on uint32 variables and no range checks on uint8. This patch fixes the
problem.

Fixes: 8bfd06f073c8 state: uint8: add range check for uint8
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 common/state.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/common/state.c b/common/state.c
index 7076f5764d1f..e21fd59a3ee7 100644
--- a/common/state.c
+++ b/common/state.c
@@ -171,8 +171,8 @@ static struct state_variable *state_uint8_create(struct state *state,
 
 	su32 = xzalloc(sizeof(*su32));
 
-	param = dev_add_param_int(&state->dev, name, state_set_dirty,
-				  NULL, &su32->value, "%d", state);
+	param = dev_add_param_int(&state->dev, name, state_uint8_set,
+				  NULL, &su32->value, "%d", su32);
 	if (IS_ERR(param)) {
 		free(su32);
 		return ERR_CAST(param);
-- 
2.1.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] state: fix range check on uint8 and uint32 variables
  2015-07-03 14:07 [PATCH] state: fix range check on uint8 and uint32 variables Marc Kleine-Budde
@ 2015-07-03 14:08 ` Marc Kleine-Budde
  2015-07-03 14:16 ` Marc Kleine-Budde
  1 sibling, 0 replies; 3+ messages in thread
From: Marc Kleine-Budde @ 2015-07-03 14:08 UTC (permalink / raw)
  To: barebox; +Cc: sha


[-- Attachment #1.1: Type: text/plain, Size: 1112 bytes --]

On 07/03/2015 04:07 PM, Marc Kleine-Budde wrote:
> The patch "8bfd06f073c8 state: uint8: add range check for uint8" as applied not
> correctly to the repository. It was supposed to change the state_uint8_create()
> function:
> 
> |  static struct state_variable *state_uint8_create(struct state *state,
> |
> |  	su32 = xzalloc(sizeof(*su32));
> |
> | -	param = dev_add_param_int(&state->dev, name, state_set_dirty,
> | -				  NULL, &su32->value, "%u", state);
> | +	param = dev_add_param_int(&state->dev, name, state_uint8_set,
> | +				  NULL, &su32->value, "%u", su32);
> 
> but the state_uint32_create() was changed instead, which leads to broken range
> checks on uint32 variables and no range checks on uint8. This patch fixes the
> problem.

Doh! I forgot the second part to the patch - will send v2.

Marc

-- 
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |


[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 455 bytes --]

[-- Attachment #2: Type: text/plain, Size: 149 bytes --]

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] state: fix range check on uint8 and uint32 variables
  2015-07-03 14:07 [PATCH] state: fix range check on uint8 and uint32 variables Marc Kleine-Budde
  2015-07-03 14:08 ` Marc Kleine-Budde
@ 2015-07-03 14:16 ` Marc Kleine-Budde
  1 sibling, 0 replies; 3+ messages in thread
From: Marc Kleine-Budde @ 2015-07-03 14:16 UTC (permalink / raw)
  To: barebox; +Cc: sha


[-- Attachment #1.1: Type: text/plain, Size: 1165 bytes --]

On 07/03/2015 04:07 PM, Marc Kleine-Budde wrote:
> The patch "8bfd06f073c8 state: uint8: add range check for uint8" as applied not
> correctly to the repository. It was supposed to change the state_uint8_create()
> function:
> 
> |  static struct state_variable *state_uint8_create(struct state *state,
> |
> |  	su32 = xzalloc(sizeof(*su32));
> |
> | -	param = dev_add_param_int(&state->dev, name, state_set_dirty,
> | -				  NULL, &su32->value, "%u", state);
> | +	param = dev_add_param_int(&state->dev, name, state_uint8_set,
> | +				  NULL, &su32->value, "%u", su32);
> 
> but the state_uint32_create() was changed instead, which leads to broken range
> checks on uint32 variables and no range checks on uint8. This patch fixes the
> problem.

Sorry for the noise, that error occurred while rebasing my code to the
current release....origin/next is fine.

Marc

-- 
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |


[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 455 bytes --]

[-- Attachment #2: Type: text/plain, Size: 149 bytes --]

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-07-03 14:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-03 14:07 [PATCH] state: fix range check on uint8 and uint32 variables Marc Kleine-Budde
2015-07-03 14:08 ` Marc Kleine-Budde
2015-07-03 14:16 ` Marc Kleine-Budde

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox