From patchwork Mon Nov 27 16:00:07 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Lieven X-Patchwork-Id: 10077179 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 588886028E for ; Mon, 27 Nov 2017 16:01:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 49E9828E69 for ; Mon, 27 Nov 2017 16:01:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3E86E28EA9; Mon, 27 Nov 2017 16:01:33 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 32D9C28E69 for ; Mon, 27 Nov 2017 16:01:31 +0000 (UTC) Received: from localhost ([::1]:33419 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eJLqc-0002dw-U8 for patchwork-qemu-devel@patchwork.kernel.org; Mon, 27 Nov 2017 11:01:30 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37522) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eJLpV-0002KW-1w for qemu-devel@nongnu.org; Mon, 27 Nov 2017 11:00:30 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eJLpQ-00014t-92 for qemu-devel@nongnu.org; Mon, 27 Nov 2017 11:00:21 -0500 Received: from mx-v6.kamp.de ([2a02:248:0:51::16]:47203 helo=mx01.kamp.de) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eJLpP-000127-Vg for qemu-devel@nongnu.org; Mon, 27 Nov 2017 11:00:16 -0500 Received: (qmail 30207 invoked by uid 89); 27 Nov 2017 16:00:12 -0000 Received: from [195.62.97.28] by client-16-kamp (envelope-from , uid 89) with qmail-scanner-2010/03/19-MF (clamdscan: 0.99.2/24078. avast: 1.2.2/17010300. spamassassin: 3.4.1. Clear:RC:1(195.62.97.28):. Processed in 0.031819 secs); 27 Nov 2017 16:00:12 -0000 Received: from smtp.kamp.de (HELO submission.kamp.de) ([195.62.97.28]) by mx01.kamp.de with ESMTPS (DHE-RSA-AES256-GCM-SHA384 encrypted); 27 Nov 2017 16:00:12 -0000 X-GL_Whitelist: yes Received: (qmail 8934 invoked from network); 27 Nov 2017 16:00:11 -0000 Received: from lieven-pc.kamp-intra.net (HELO lieven-pc) (relay@kamp.de@::ffff:172.21.12.60) by submission.kamp.de with ESMTPS (DHE-RSA-AES256-GCM-SHA384 encrypted) ESMTPA; 27 Nov 2017 16:00:11 -0000 Received: by lieven-pc (Postfix, from userid 1000) id CA203207CD; Mon, 27 Nov 2017 17:00:11 +0100 (CET) From: Peter Lieven To: qemu-devel@nongnu.org, qemu-block@nongnu.org Date: Mon, 27 Nov 2017 17:00:07 +0100 Message-Id: <1511798407-31129-1-git-send-email-pl@kamp.de> X-Mailer: git-send-email 1.9.1 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a02:248:0:51::16 Subject: [Qemu-devel] [PATCH for-2.11] block/nfs: fix nfs_client_open for filesize greater than 1TB X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, jcody@redhat.com, Peter Lieven , qemu-stable@nongnu.org, mreitz@redhat.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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 --- block/nfs.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/block/nfs.c b/block/nfs.c index 337fcd9..effc871 100644 --- a/block/nfs.c +++ b/block/nfs.c @@ -1,7 +1,7 @@ /* * QEMU Block driver for native access to files on NFS shares * - * Copyright (c) 2014-2016 Peter Lieven + * Copyright (c) 2014-2017 Peter Lieven * * Permission is hereby granted, free of charge, to any person obtaining a copy * 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, int flags, int open_flags, Error **errp) { - int ret = -EINVAL; + int64_t ret = -EINVAL; QemuOpts *opts = NULL; Error *local_err = NULL; struct stat st; @@ -686,8 +686,7 @@ static QemuOptsList nfs_create_opts = { static int nfs_file_create(const char *url, QemuOpts *opts, Error **errp) { - int ret = 0; - int64_t total_size = 0; + int64_t ret, total_size; NFSClient *client = g_new0(NFSClient, 1); QDict *options = NULL;