Revision 8
pointer validation in util_sys_inb
lab2/timer.c | ||
---|---|---|
61 | 61 |
} |
62 | 62 |
if(timer_print_config(timer, field, conf)) return 1; |
63 | 63 |
} |
64 |
if(field == tsf_all || field == tsf_mode){
|
|
64 |
if(field == tsf_mode){ |
|
65 | 65 |
conf.count_mode = (st & TIMER_MODE_MASK)>>TIMER_MODE_POS; |
66 | 66 |
if(timer_print_config(timer, field, conf)) return 1; |
67 | 67 |
} |
68 |
if(field == tsf_all || field == tsf_base){
|
|
68 |
if(field == tsf_base){ |
|
69 | 69 |
conf.bcd = st & TIMER_BCD; |
70 | 70 |
if(timer_print_config(timer, field, conf)) return 1; |
71 | 71 |
} |
lab2/utils.c | ||
---|---|---|
19 | 19 |
|
20 | 20 |
int (util_sys_inb)(int port, uint8_t *value) { |
21 | 21 |
/* To be implemented by the students */ |
22 |
if(value == NULL) return 1; |
|
22 | 23 |
uint32_t n = 0; |
23 | 24 |
int ret = sys_inb(port, &n); |
24 | 25 |
*value = n; |
Also available in: Unified diff