aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/tables/tbutils.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/tables/tbutils.c')
-rw-r--r--drivers/acpi/tables/tbutils.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/acpi/tables/tbutils.c b/drivers/acpi/tables/tbutils.c
index e6dfe688b76b..9d0bf536d674 100644
--- a/drivers/acpi/tables/tbutils.c
+++ b/drivers/acpi/tables/tbutils.c
@@ -240,16 +240,16 @@ acpi_tb_verify_table_checksum(struct acpi_table_header * table_header)
240 240
241u8 acpi_tb_generate_checksum(void *buffer, u32 length) 241u8 acpi_tb_generate_checksum(void *buffer, u32 length)
242{ 242{
243 const u8 *limit; 243 u8 *end_buffer;
244 const u8 *rover; 244 u8 *rover;
245 u8 sum = 0; 245 u8 sum = 0;
246 246
247 if (buffer && length) { 247 if (buffer && length) {
248 /* Buffer and Length are valid */ 248 /* Buffer and Length are valid */
249 249
250 limit = (u8 *) buffer + length; 250 end_buffer = ACPI_ADD_PTR(u8, buffer, length);
251 251
252 for (rover = buffer; rover < limit; rover++) { 252 for (rover = buffer; rover < end_buffer; rover++) {
253 sum = (u8) (sum + *rover); 253 sum = (u8) (sum + *rover);
254 } 254 }
255 } 255 }