msm: mdss: correct the validating method of debug name string
The name member in mdss_debug_base struct is not a pointer, so the current method to check whether this name string is empty is invalid. Use strlen to fix this bug which might introduce NULL pointer references in some cases if the name string is empty. Change-Id: I52b5eeae5f303e5690ce1e6a4ce00debf3435ee2 Signed-off-by: Ray Zhang <rayz@codeaurora.org>
This commit is contained in:
parent
58a516841b
commit
0644e8bc24
1 changed files with 3 additions and 3 deletions
|
@ -513,7 +513,7 @@ static void mdss_dump_reg_by_blk(const char *blk_name)
|
|||
return;
|
||||
|
||||
list_for_each_entry_safe(blk_base, tmp, &mdd->base_list, head) {
|
||||
if (blk_base->name &&
|
||||
if (strlen(blk_base->name) &&
|
||||
!strcmp(blk_base->name, blk_name)) {
|
||||
mdss_dump_reg_by_ranges(blk_base,
|
||||
mdss_dbg_xlog.enable_reg_dump);
|
||||
|
@ -532,7 +532,7 @@ static void mdss_dump_reg_all(void)
|
|||
return;
|
||||
|
||||
list_for_each_entry_safe(blk_base, tmp, &mdd->base_list, head) {
|
||||
if (blk_base->name)
|
||||
if (strlen(blk_base->name))
|
||||
mdss_dump_reg_by_blk(blk_base->name);
|
||||
}
|
||||
}
|
||||
|
@ -556,7 +556,7 @@ struct mdss_debug_base *get_dump_blk_addr(const char *blk_name)
|
|||
return NULL;
|
||||
|
||||
list_for_each_entry_safe(blk_base, tmp, &mdd->base_list, head) {
|
||||
if (blk_base->name &&
|
||||
if (strlen(blk_base->name) &&
|
||||
!strcmp(blk_base->name, blk_name))
|
||||
return blk_base;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue