Skip to content

Commit f1a7ff7

Browse files
plievenXanClic
authored andcommitted
block/nfs: fix nfs_client_open for filesize greater than 1TB
DIV_ROUND_UP(st.st_size, BDRV_SECTOR_SIZE) was overflowing ret (int) if st.st_size is greater than 1TB. Cc: qemu-stable@nongnu.org Signed-off-by: Peter Lieven <pl@kamp.de> Message-id: 1511798407-31129-1-git-send-email-pl@kamp.de Signed-off-by: Max Reitz <mreitz@redhat.com>
1 parent fc24908 commit f1a7ff7

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

block/nfs.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* QEMU Block driver for native access to files on NFS shares
33
*
4-
* Copyright (c) 2014-2016 Peter Lieven <pl@kamp.de>
4+
* Copyright (c) 2014-2017 Peter Lieven <pl@kamp.de>
55
*
66
* Permission is hereby granted, free of charge, to any person obtaining a copy
77
* of this software and associated documentation files (the "Software"), to deal
@@ -496,7 +496,7 @@ static NFSServer *nfs_config(QDict *options, Error **errp)
496496
static int64_t nfs_client_open(NFSClient *client, QDict *options,
497497
int flags, int open_flags, Error **errp)
498498
{
499-
int ret = -EINVAL;
499+
int64_t ret = -EINVAL;
500500
QemuOpts *opts = NULL;
501501
Error *local_err = NULL;
502502
struct stat st;
@@ -686,8 +686,7 @@ static QemuOptsList nfs_create_opts = {
686686

687687
static int nfs_file_create(const char *url, QemuOpts *opts, Error **errp)
688688
{
689-
int ret = 0;
690-
int64_t total_size = 0;
689+
int64_t ret, total_size;
691690
NFSClient *client = g_new0(NFSClient, 1);
692691
QDict *options = NULL;
693692

0 commit comments

Comments
 (0)