Skip to content

Commit cb1b78f

Browse files
dcuiliuw
authored andcommitted
tools: hv: Fix a complier warning in the fcopy uio daemon
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: 82b0945 ("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: <[email protected]>
1 parent fac04ef commit cb1b78f

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

tools/hv/hv_fcopy_uio_daemon.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@
3535
#define WIN8_SRV_MINOR 1
3636
#define WIN8_SRV_VERSION (WIN8_SRV_MAJOR << 16 | WIN8_SRV_MINOR)
3737

38-
#define MAX_FOLDER_NAME 15
39-
#define MAX_PATH_LEN 15
4038
#define FCOPY_UIO "/sys/bus/vmbus/devices/eb765408-105f-49b6-b4aa-c123b64d17d4/uio"
4139

4240
#define FCOPY_VER_COUNT 1
@@ -51,7 +49,7 @@ static const int fw_versions[] = {
5149

5250
#define HV_RING_SIZE 0x4000 /* 16KB ring buffer size */
5351

54-
unsigned char desc[HV_RING_SIZE];
52+
static unsigned char desc[HV_RING_SIZE];
5553

5654
static int target_fd;
5755
static char target_fname[PATH_MAX];
@@ -409,8 +407,8 @@ int main(int argc, char *argv[])
409407
struct vmbus_br txbr, rxbr;
410408
void *ring;
411409
uint32_t len = HV_RING_SIZE;
412-
char uio_name[MAX_FOLDER_NAME] = {0};
413-
char uio_dev_path[MAX_PATH_LEN] = {0};
410+
char uio_name[NAME_MAX] = {0};
411+
char uio_dev_path[PATH_MAX] = {0};
414412

415413
static struct option long_options[] = {
416414
{"help", no_argument, 0, 'h' },

0 commit comments

Comments
 (0)