summaryrefslogtreecommitdiff
path: root/drivers/staging/greybus/fw-management.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2024-05-22 22:11:48 +0300
committerLinus Torvalds <torvalds@linux-foundation.org>2024-05-22 22:11:48 +0300
commitbe81389c82e2c1ed0997629cb3d910f584666e33 (patch)
treef5e7e34d3d13ae9b1c70c562bfb1f2eba7bd1684 /drivers/staging/greybus/fw-management.c
parentf6b8e86b7a65495d3947a1d1fc22183c52f786f6 (diff)
parenteb563dc752d33b0a5d4952964af15ca892f59524 (diff)
downloadlinux-be81389c82e2c1ed0997629cb3d910f584666e33.tar.xz
Merge tag 'staging-6.10-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging
Pull staging driver updates from Greg KH: "Here is the big set of staging driver changes for 6.10-rc1. Not a lot of cleanups happening this kernel release, intern applications must be out of sync at the moment. But we did delete two drivers, wlan-ng and pi433, as they are no longer in use and the developers involved wanted them just gone entirely, allowing us to drop 19k lines from the tree. Other than the normal coding style cleanups here, there has been a lot of work on the vc04_services code, with the intent to finally get that out of staging hopefully soon. It's getting closer, which is nice to see. All of these have been in linux-next for a while with no reported issues" * tag 'staging-6.10-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: (98 commits) staging: pi433: Remove unused driver staging: vchiq_core: Add missing blank lines staging: vchiq_core: Drop unnecessary blank lines staging: vchiq_core: Add parentheses to VCHIQ_MSG_SRCPORT staging: vchiq_core: Use printk messages for devices staging: vchiq_arm: Drop unnecessary NULL check staging: vc04_services: Delete unnecessary NULL check staging: vc04_services: vchiq_arm: Fix NULL ptr dereferences Staging: rtl8192e: Rename variable DssCCk Staging: rtl8192e: Rename variable ExtHTCapInfo Staging: rtl8192e: Rename variable MPDUDensity Staging: rtl8192e: Rename variable MaxRxAMPDUFactor Staging: rtl8192e: Rename variable MaxAMSDUSize Staging: rtl8192e: Rename variable DelayBA Staging: rtl8192e: Rename variable RxSTBC Staging: rtl8192e: Rename variable TxSTBC Staging: rtl8192e: Rename variable GreenField Staging: rtl8192e: Rename variable ShortGI20Mhz Staging: rtl8192e: Rename variable ShortGI40Mhz Staging: rtl8192e: Rename variable MimoPwrSave ...
Diffstat (limited to 'drivers/staging/greybus/fw-management.c')
-rw-r--r--drivers/staging/greybus/fw-management.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/drivers/staging/greybus/fw-management.c b/drivers/staging/greybus/fw-management.c
index 3054f084d777..a47385175582 100644
--- a/drivers/staging/greybus/fw-management.c
+++ b/drivers/staging/greybus/fw-management.c
@@ -123,8 +123,7 @@ static int fw_mgmt_interface_fw_version_operation(struct fw_mgmt *fw_mgmt,
fw_info->major = le16_to_cpu(response.major);
fw_info->minor = le16_to_cpu(response.minor);
- strncpy(fw_info->firmware_tag, response.firmware_tag,
- GB_FIRMWARE_TAG_MAX_SIZE);
+ strscpy_pad(fw_info->firmware_tag, response.firmware_tag);
/*
* The firmware-tag should be NULL terminated, otherwise throw error but
@@ -153,7 +152,7 @@ static int fw_mgmt_load_and_validate_operation(struct fw_mgmt *fw_mgmt,
}
request.load_method = load_method;
- strncpy(request.firmware_tag, tag, GB_FIRMWARE_TAG_MAX_SIZE);
+ strscpy_pad(request.firmware_tag, tag);
/*
* The firmware-tag should be NULL terminated, otherwise throw error and
@@ -249,8 +248,7 @@ static int fw_mgmt_backend_fw_version_operation(struct fw_mgmt *fw_mgmt,
struct gb_fw_mgmt_backend_fw_version_response response;
int ret;
- strncpy(request.firmware_tag, fw_info->firmware_tag,
- GB_FIRMWARE_TAG_MAX_SIZE);
+ strscpy_pad(request.firmware_tag, fw_info->firmware_tag);
/*
* The firmware-tag should be NULL terminated, otherwise throw error and
@@ -303,13 +301,13 @@ static int fw_mgmt_backend_fw_update_operation(struct fw_mgmt *fw_mgmt,
struct gb_fw_mgmt_backend_fw_update_request request;
int ret;
- strncpy(request.firmware_tag, tag, GB_FIRMWARE_TAG_MAX_SIZE);
+ ret = strscpy_pad(request.firmware_tag, tag);
/*
* The firmware-tag should be NULL terminated, otherwise throw error and
* fail.
*/
- if (request.firmware_tag[GB_FIRMWARE_TAG_MAX_SIZE - 1] != '\0') {
+ if (ret == -E2BIG) {
dev_err(fw_mgmt->parent, "backend-update: firmware-tag is not NULL terminated\n");
return -EINVAL;
}