]> Git Repo - J-linux.git/commitdiff
tools: hv: Fix a complier warning in the fcopy uio daemon
authorDexuan Cui <[email protected]>
Tue, 10 Sep 2024 00:44:32 +0000 (00:44 +0000)
committerWei Liu <[email protected]>
Mon, 9 Dec 2024 18:42:42 +0000 (18:42 +0000)
hv_fcopy_uio_daemon.c:436:53: warning: '%s' directive output may be truncated
writing up to 14 bytes into a region of size 10 [-Wformat-truncation=]
  436 |  snprintf(uio_dev_path, sizeof(uio_dev_path), "/dev/%s", uio_name);

Also added 'static' for the array 'desc[]'.

Fixes: 82b0945ce2c2 ("tools: hv: Add new fcopy application based on uio driver")
Cc: [email protected] # 6.10+
Signed-off-by: Dexuan Cui <[email protected]>
Reviewed-by: Saurabh Sengar <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Wei Liu <[email protected]>
Message-ID: <20240910004433[email protected]>

tools/hv/hv_fcopy_uio_daemon.c

index 7a00f3066a980706facb95dc75c3670f0442ec2f..12743d7f164f0dd9600e7a26d0b8b2a77f440ca8 100644 (file)
@@ -35,8 +35,6 @@
 #define WIN8_SRV_MINOR         1
 #define WIN8_SRV_VERSION       (WIN8_SRV_MAJOR << 16 | WIN8_SRV_MINOR)
 
-#define MAX_FOLDER_NAME                15
-#define MAX_PATH_LEN           15
 #define FCOPY_UIO              "/sys/bus/vmbus/devices/eb765408-105f-49b6-b4aa-c123b64d17d4/uio"
 
 #define FCOPY_VER_COUNT                1
@@ -51,7 +49,7 @@ static const int fw_versions[] = {
 
 #define HV_RING_SIZE           0x4000 /* 16KB ring buffer size */
 
-unsigned char desc[HV_RING_SIZE];
+static unsigned char desc[HV_RING_SIZE];
 
 static int target_fd;
 static char target_fname[PATH_MAX];
@@ -409,8 +407,8 @@ int main(int argc, char *argv[])
        struct vmbus_br txbr, rxbr;
        void *ring;
        uint32_t len = HV_RING_SIZE;
-       char uio_name[MAX_FOLDER_NAME] = {0};
-       char uio_dev_path[MAX_PATH_LEN] = {0};
+       char uio_name[NAME_MAX] = {0};
+       char uio_dev_path[PATH_MAX] = {0};
 
        static struct option long_options[] = {
                {"help",        no_argument,       0,  'h' },
This page took 0.049558 seconds and 4 git commands to generate.