diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2014-02-04 19:07:47 +0100 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2014-02-04 19:07:47 +0100 |
commit | e6f93609728d0ad864fc2d7dacd9df128eccd37a (patch) | |
tree | 92b723526b3fa6abdd678425221e227b462e2e85 | |
parent | 3bc572030b864b2ef922325b7e4ed85a7c178200 (diff) |
Fix potential NULL dereference
Found by Coverity
* i386/i386/user_ldt.c (i386_get_ldt): Fetch `pcb' field of `thread'
only after looking for `thread' being NULL.
-rw-r--r-- | i386/i386/user_ldt.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/i386/i386/user_ldt.c b/i386/i386/user_ldt.c index a83bc12..3a2c1cc 100644 --- a/i386/i386/user_ldt.c +++ b/i386/i386/user_ldt.c @@ -262,7 +262,7 @@ i386_get_ldt(thread, first_selector, selector_count, desc_list, count) unsigned int *count; /* in/out */ { struct user_ldt *user_ldt; - pcb_t pcb = thread->pcb; + pcb_t pcb; int first_desc = sel_idx(first_selector); unsigned int ldt_count; vm_size_t ldt_size; @@ -276,6 +276,7 @@ i386_get_ldt(thread, first_selector, selector_count, desc_list, count) if (first_desc + selector_count >= 8192) return KERN_INVALID_ARGUMENT; + pcb = thread->pcb; addr = 0; size = 0; |