From patchwork Fri Apr 3 11:01:54 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bogdan Purcareata X-Patchwork-Id: 457968 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id E16221401B1 for ; Fri, 3 Apr 2015 23:33:34 +1100 (AEDT) Received: from localhost ([::1]:34010 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ye0mz-0007PR-4T for incoming@patchwork.ozlabs.org; Fri, 03 Apr 2015 08:33:33 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41688) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ye0mh-00078v-8U for qemu-devel@nongnu.org; Fri, 03 Apr 2015 08:33:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ye0mc-0000t9-0x for qemu-devel@nongnu.org; Fri, 03 Apr 2015 08:33:15 -0400 Received: from mail-bn1bon0110.outbound.protection.outlook.com ([157.56.111.110]:16323 helo=na01-bn1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ye0mb-0000t1-Rp for qemu-devel@nongnu.org; Fri, 03 Apr 2015 08:33:09 -0400 Received: from DM2PR03CA0038.namprd03.prod.outlook.com (10.141.96.37) by SN2PR03MB064.namprd03.prod.outlook.com (10.255.175.152) with Microsoft SMTP Server (TLS) id 15.1.112.19; Fri, 3 Apr 2015 11:01:59 +0000 Received: from BN1BFFO11FD034.protection.gbl (2a01:111:f400:7c10::1:111) by DM2PR03CA0038.outlook.office365.com (2a01:111:e400:2428::37) with Microsoft SMTP Server (TLS) id 15.1.130.23 via Frontend Transport; Fri, 3 Apr 2015 11:01:58 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=freescale.com; nongnu.org; dkim=none (message not signed) header.d=none; Received-SPF: Fail (protection.outlook.com: domain of freescale.com does not designate 192.88.168.50 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.168.50; helo=tx30smr01.am.freescale.net; Received: from tx30smr01.am.freescale.net (192.88.168.50) by BN1BFFO11FD034.mail.protection.outlook.com (10.58.144.97) with Microsoft SMTP Server (TLS) id 15.1.136.16 via Frontend Transport; Fri, 3 Apr 2015 11:01:58 +0000 Received: from localhost.localdomain (B07892-01.ea.freescale.net [10.171.74.79] (may be forged)) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id t33B1uKw005179 for ; Fri, 3 Apr 2015 04:01:57 -0700 From: Bogdan Purcareata To: Date: Fri, 3 Apr 2015 11:01:54 +0000 Message-ID: <1428058914-32050-1-git-send-email-bogdan.purcareata@freescale.com> X-Mailer: git-send-email 2.1.4 X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:192.88.168.50; CTRY:US; IPV:NLI; EFV:NLI; BMV:1; SFV:NSPM; SFS:(10019020)(6009001)(339900001)(199003)(189002)(77096005)(19580405001)(105606002)(87936001)(106466001)(50466002)(62966003)(33646002)(77156002)(229853001)(110136001)(36756003)(50986999)(104016003)(85426001)(49486002)(92566002)(6806004)(450100001)(50226001)(46102003)(107886001)(48376002)(2351001)(47776003)(19580395003)(42866002); DIR:OUT; SFP:1102; SCL:1; SRVR:SN2PR03MB064; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; MLV:sfv; A:1; MX:1; LANG:en; MIME-Version: 1.0 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:SN2PR03MB064; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(5005006)(5002010); SRVR:SN2PR03MB064; BCL:0; PCL:0; RULEID:; SRVR:SN2PR03MB064; X-Forefront-PRVS: 05352A48BE X-OriginatorOrg: freescale.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Apr 2015 11:01:58.2798 (UTC) X-MS-Exchange-CrossTenant-Id: 710a03f5-10f6-4d38-9ff4-a80b81da590d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=710a03f5-10f6-4d38-9ff4-a80b81da590d; Ip=[192.88.168.50]; Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN2PR03MB064 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 X-Received-From: 157.56.111.110 Subject: [Qemu-devel] [PATCH] nbd/trivial: fix type cast for ioctl X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org This fixes ioctl behavior on powerpc e6500 platforms with 64bit kernel and 32bit userspace. The current type cast has no effect there and the value passed to the kernel is still 0. Probably an issue related to the compiler, since I'm assuming the same configuration works on a similar setup on x86. Also ensure consistency with previous type cast in TRACE message. Signed-off-by: Bogdan Purcareata --- nbd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nbd.c b/nbd.c index 91b7d56..da81a5b 100644 --- a/nbd.c +++ b/nbd.c @@ -681,7 +681,7 @@ int nbd_init(int fd, int csock, uint32_t flags, off_t size) TRACE("Setting size to %zd block(s)", (size_t)(size / BDRV_SECTOR_SIZE)); - if (ioctl(fd, NBD_SET_SIZE_BLOCKS, size / (size_t)BDRV_SECTOR_SIZE) < 0) { + if (ioctl(fd, NBD_SET_SIZE_BLOCKS, (size_t)(size / BDRV_SECTOR_SIZE) < 0)) { int serrno = errno; LOG("Failed setting size (in blocks)"); return -serrno;