summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Ziswiler <marcel.ziswiler@toradex.com>2013-05-28 08:26:04 +0200
committerMarcel Ziswiler <marcel.ziswiler@toradex.com>2013-05-28 08:26:04 +0200
commit658a5957747cd3f2d1d90f4983fec28a116851cd (patch)
tree4d069435f4c1b3ccd5e7ba3f7bc11966e57f0d6e
parent0168facf489dab82af075950dfee821676419da8 (diff)
apalis/colibri_t20/30: fix overflow in HCD conversionT30_LinuxImageV2.0Beta2_20130626Apalis_T30_LinuxImageV2.0Beta1_20130626
Fix possible overflow condition in serial number to hexadecimal coded decimal conversion routine.
-rw-r--r--board/toradex/common/board.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/board/toradex/common/board.c b/board/toradex/common/board.c
index 3502d085c0f..934266ef6aa 100644
--- a/board/toradex/common/board.c
+++ b/board/toradex/common/board.c
@@ -736,12 +736,11 @@ void get_board_serial(struct tag_serialnr *serialnr)
array[i--] = serial % 10;
serial /= 10;
}
- serial = 0;
- for (i = 0; i < 8; i++) {
- serial += array[i];
+ serial = array[0];
+ for (i = 1; i < 8; i++) {
serial *= 16;
+ serial += array[i];
}
- serial /= 16;
}
serialnr->low = serial;