Skip to content

Commit

Permalink
remoteproc_get_mem could wrongly match on name
Browse files Browse the repository at this point in the history
Bound name comparison by RPROC_MAX_NAME_LEN instead of length of search string
Signed-off-by: Tammy Leino <tammy_leino@mentor.com>
  • Loading branch information
tammyleino authored and arnopo committed Apr 20, 2022
1 parent e4307e1 commit 0d75fa7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/remoteproc/remoteproc.c
Expand Up @@ -48,7 +48,7 @@ remoteproc_get_mem(struct remoteproc *rproc, const char *name,
metal_list_for_each(&rproc->mems, node) {
mem = metal_container_of(node, struct remoteproc_mem, node);
if (name) {
if (!strncmp(name, mem->name, strlen(name)))
if (!strncmp(name, mem->name, RPROC_MAX_NAME_LEN))
return mem;
} else if (pa != METAL_BAD_PHYS) {
metal_phys_addr_t pa_start, pa_end;
Expand Down

0 comments on commit 0d75fa7

Please sign in to comment.