Skip to contentSkip to conversation

soc: qcom: cmd-db: refactor deprecated strncpy

PATCH In review Shubh 2 participants 2 messages Oct 4, 2023

Subsystems (2)
lore
Share & tools
lore

Shubh

author
#0 lore raw

PATCH 1/1 soc: qcom: cmd-db: refactor deprecated strncpy

Prefer strscpy_pad to strncpy.

---
 drivers/soc/qcom/cmd-db.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/soc/qcom/cmd-db.c +1 -1
index 34c40368d..dc42704d7 100644
@@ -152,7 +152,7 @@ static int cmd_db_get_header(const char *id, const struct entry_header **eh,
 	 * query string is not necessarily '\0' terminated if it bumps up
 	 * against the max size. That's OK and expected.
 	 */
-	strncpy(query, id, sizeof(query));
+	strscpy_pad(query, id, sizeof(query));
 
 	for (i = 0; i < MAX_SLV_ID; i++) {
 		rsc_hdr = &cmd_db_header->header[i];
Signature · 1 line
2.42.0
#1 lore raw
Quoted 3 lines · Shubh

Prefer strscpy_pad to strncpy.

Please spell out your name on future patches.

Quoted 9 lines
---
 drivers/soc/qcom/cmd-db.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/soc/qcom/cmd-db.c +0 -0
index 34c40368d..dc42704d7 100644

drivers/soc/qcom/cmd-db.c static int cmd_db_get_header(const char *id, const struct entry_header **eh, · line 155

Quoted 5 lines
drivers/soc/qcom/cmd-db.c +1 -1
@@ -152,7 +152,7 @@ static int cmd_db_get_header(const char *id, const struct entry_header **eh,
 	 * query string is not necessarily '\0' terminated if it bumps up
 	 * against the max size. That's OK and expected.
 	 */
-	strncpy(query, id, sizeof(query));
+	strscpy_pad(query, id, sizeof(query));

Please read the comment above, and please read fe72f9bce137 ("soc: qcom:
cmd-db: replace strscpy_pad() with strncpy()")

Thanks,
Bjorn

Quoted 6 lines
drivers/soc/qcom/cmd-db.c +0 -0
 	for (i = 0; i < MAX_SLV_ID; i++) {
 		rsc_hdr = &cmd_db_header->header[i];
Signature · 1 line
2.42.0