mirror of
https://gitlab.com/qemu-project/qemu
synced 2024-09-06 18:05:37 +00:00
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>
This commit is contained in:
parent
fc24908e7d
commit
f1a7ff770f
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* QEMU Block driver for native access to files on NFS shares
|
* QEMU Block driver for native access to files on NFS shares
|
||||||
*
|
*
|
||||||
* Copyright (c) 2014-2016 Peter Lieven <pl@kamp.de>
|
* Copyright (c) 2014-2017 Peter Lieven <pl@kamp.de>
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
@ -496,7 +496,7 @@ out:
|
||||||
static int64_t nfs_client_open(NFSClient *client, QDict *options,
|
static int64_t nfs_client_open(NFSClient *client, QDict *options,
|
||||||
int flags, int open_flags, Error **errp)
|
int flags, int open_flags, Error **errp)
|
||||||
{
|
{
|
||||||
int ret = -EINVAL;
|
int64_t ret = -EINVAL;
|
||||||
QemuOpts *opts = NULL;
|
QemuOpts *opts = NULL;
|
||||||
Error *local_err = NULL;
|
Error *local_err = NULL;
|
||||||
struct stat st;
|
struct stat st;
|
||||||
|
@ -686,8 +686,7 @@ static QemuOptsList nfs_create_opts = {
|
||||||
|
|
||||||
static int nfs_file_create(const char *url, QemuOpts *opts, Error **errp)
|
static int nfs_file_create(const char *url, QemuOpts *opts, Error **errp)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int64_t ret, total_size;
|
||||||
int64_t total_size = 0;
|
|
||||||
NFSClient *client = g_new0(NFSClient, 1);
|
NFSClient *client = g_new0(NFSClient, 1);
|
||||||
QDict *options = NULL;
|
QDict *options = NULL;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue