]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
soc: qcom: cmd-db: use strncmp() instead of memcmp()
authorCaleb Connolly <caleb.connolly@linaro.org>
Thu, 8 Aug 2024 23:59:32 +0000 (01:59 +0200)
committerCaleb Connolly <caleb.connolly@linaro.org>
Fri, 6 Sep 2024 08:47:46 +0000 (10:47 +0200)
memcmp() can cause aborts on some platforms and generally seems to be
the wrong approach here. Use strncmp() instead which is more correct.

Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
drivers/soc/qcom/cmd-db.c

index 08736ea936aee7a802fb92df80c4a2c834ca8128..c7c5230983d5b1509ac2e8c58198e13a9058fef8 100644 (file)
@@ -141,7 +141,7 @@ static int cmd_db_get_header(const char *id, const struct entry_header **eh,
 
                ent = rsc_to_entry_header(rsc_hdr);
                for (j = 0; j < le16_to_cpu(rsc_hdr->cnt); j++, ent++) {
-                       if (memcmp(ent->id, query, sizeof(ent->id)) == 0) {
+                       if (strncmp(ent->id, query, sizeof(ent->id)) == 0) {
                                if (eh)
                                        *eh = ent;
                                if (rh)