Skip to content

Commit

Permalink
Replace '(unsigned long)strtoull()' with 'strtoul()'
Browse files Browse the repository at this point in the history
  • Loading branch information
bcoles committed Dec 31, 2022
1 parent c012c35 commit 07fcda8
Show file tree
Hide file tree
Showing 15 changed files with 15 additions and 17 deletions.
2 changes: 1 addition & 1 deletion src/bcm_msg_head_struct.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ unsigned long get_kernel_addr_from_bcm_msg_head_struct() {
snprintf(addrs, sizeof(addrs), "%02x%02x%02x%02x", buf[39], buf[38], buf[37],
buf[36]);

addr = (unsigned long)strtoull(addrs, &endptr, 16);
addr = strtoul(addrs, &endptr, 16);

if (addr >= KERNEL_BASE_MIN && addr <= KERNEL_BASE_MAX)
return addr;
Expand Down
2 changes: 1 addition & 1 deletion src/dmesg_android_ion_snapshot.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ unsigned long search_dmesg_ion_snapshot() {
if (addr_buf == NULL)
return 0;

addr = strtoull(&addr_buf[strlen(needle2)], &endptr, 16);
addr = strtoul(&addr_buf[strlen(needle2)], &endptr, 16);

if (addr >= KERNEL_BASE_MIN && addr <= KERNEL_BASE_MAX)
return addr;
Expand Down
2 changes: 1 addition & 1 deletion src/dmesg_backtrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ unsigned long search_dmesg_kernel_pointers() {

ptr = strtok(syslog, "[<");
while ((ptr = strtok(NULL, "[<")) != NULL) {
leaked_addr = (unsigned long)strtoull(&ptr[0], &endptr, 16);
leaked_addr = strtoul(&ptr[0], &endptr, 16);

if (!leaked_addr)
continue;
Expand Down
2 changes: 1 addition & 1 deletion src/dmesg_driver_component_ops.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ unsigned long search_dmesg_driver_component_ops() {
if (ops_buf == NULL)
continue;

leaked_addr = (unsigned long)strtoull(&ops_buf[strlen(needle)], &endptr, 16);
leaked_addr = strtoul(&ops_buf[strlen(needle)], &endptr, 16);

if (!leaked_addr)
continue;
Expand Down
3 changes: 1 addition & 2 deletions src/dmesg_ex_handler_msr.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,7 @@ unsigned long search_dmesg_ex_handler_msr() {
if (addr_buf == NULL)
continue;

leaked_addr =
(unsigned long)strtoull(&addr_buf[strlen(needle)], &endptr, 16);
leaked_addr = strtoul(&addr_buf[strlen(needle)], &endptr, 16);

if (!leaked_addr)
continue;
Expand Down
2 changes: 1 addition & 1 deletion src/dmesg_free_reserved_area.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ unsigned long get_kernel_addr_free_reserved_area_dmesg() {
if (addr_buf == NULL)
return 0;

addr = strtoull(&addr_buf[1], &endptr, 16);
addr = strtoul(&addr_buf[1], &endptr, 16);

if (addr >= KERNEL_BASE_MIN && addr <= KERNEL_BASE_MAX)
return addr;
Expand Down
2 changes: 1 addition & 1 deletion src/dmesg_mem_init_kernel_layout.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ unsigned long search_dmesg_mem_init_kernel_text() {

ptr = strtok(addr_buf, delim);
while ((ptr = strtok(NULL, delim)) != NULL) {
addr = (unsigned long)strtoull(&ptr[0], &endptr, 16);
addr = strtoul(&ptr[0], &endptr, 16);

if (addr >= KERNEL_BASE_MIN && addr <= KERNEL_BASE_MAX)
break;
Expand Down
2 changes: 1 addition & 1 deletion src/dmesg_mmu_idmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ unsigned long search_dmesg_mmu_idmap() {

ptr = strtok(addr_buf, delim);
while ((ptr = strtok(NULL, delim)) != NULL) {
addr = (unsigned long)strtoull(&ptr[0], &endptr, 16);
addr = strtoul(&ptr[0], &endptr, 16);

if (addr >= KERNEL_BASE_MIN && addr <= KERNEL_BASE_MAX)
break;
Expand Down
2 changes: 1 addition & 1 deletion src/pppd_kallsyms.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ unsigned long get_kernel_addr_pppd_kallsyms() {
if (addr_buf == NULL)
return 0;

addr = strtoull(&addr_buf[1], &endptr, 16);
addr = strtoul(&addr_buf[1], &endptr, 16);

if (addr >= KERNEL_BASE_MIN && addr <= KERNEL_BASE_MAX)
return addr;
Expand Down
2 changes: 1 addition & 1 deletion src/proc-stat-wchan.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ unsigned long get_kernel_addr_proc_stat_wchan() {

ptr = strtok(buff, delim);
while ((ptr = strtok(NULL, delim)) != NULL) {
addr = (unsigned long)strtoull(&ptr[0], &endptr, 10);
addr = strtoul(&ptr[0], &endptr, 10);

if (addr >= KERNEL_BASE_MIN && addr <= KERNEL_BASE_MAX)
break;
Expand Down
2 changes: 1 addition & 1 deletion src/sysfs-module-sections.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ unsigned long read_module_text(char *path) {
if (strlen(buff) != addr_len + 3)
return 0;

addr = (unsigned long)strtoull(buff, &endptr, 16);
addr = strtoul(buff, &endptr, 16);

// modules may be mapped below kernel text
if (addr && addr <= KERNEL_BASE_MAX)
Expand Down
4 changes: 2 additions & 2 deletions src/sysfs_iscsi_transport_handle.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ unsigned long get_kernel_addr_iscsi_iser_transport() {
if (strlen(buff) > 21)
return 0;

addr = (unsigned long)strtoull(buff, &endptr, 10);
addr = strtoul(buff, &endptr, 10);

if (addr >= KERNEL_BASE_MIN && addr <= KERNEL_BASE_MAX)
return addr;
Expand Down Expand Up @@ -105,7 +105,7 @@ unsigned long get_kernel_addr_iscsi_sw_tcp_transport() {
if (strlen(buff) > 21)
return 0;

addr = (unsigned long)strtoull(buff, &endptr, 10);
addr = strtoul(buff, &endptr, 10);

if (addr >= KERNEL_BASE_MIN && addr <= KERNEL_BASE_MAX)
return addr;
Expand Down
2 changes: 1 addition & 1 deletion src/sysfs_nf_conntrack.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ unsigned long get_kernel_addr_conntrack() {
if (substr == NULL)
continue;

addr = strtoull(&substr[strlen(needle)], &endptr, 16);
addr = strtoul(&substr[strlen(needle)], &endptr, 16);

if (addr >= KERNEL_BASE_MIN && addr <= KERNEL_BASE_MAX)
break;
Expand Down
1 change: 0 additions & 1 deletion src/syslog_backtrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ unsigned long search_syslog_file_kernel_pointers() {
FILE *f;
char *ptr;
char *endptr;
char *line_buf;
char *line = 0;
size_t size = 0;
// We could also try /var/log/syslog.1 and /var/log/syslog.*.gz
Expand Down
2 changes: 1 addition & 1 deletion src/syslog_free_reserved_area.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ unsigned long get_kernel_addr_free_reserved_area_syslog() {
if (addr_buf == NULL)
return 0;

addr = strtoull(&addr_buf[1], &endptr, 16);
addr = strtoul(&addr_buf[1], &endptr, 16);

if (addr >= KERNEL_BASE_MIN && addr <= KERNEL_BASE_MAX)
break;
Expand Down

0 comments on commit 07fcda8

Please sign in to comment.