From nobody Wed Feb 11 04:00:42 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 150035860765091.22192480429601; Mon, 17 Jul 2017 23:16:47 -0700 (PDT) Received: from localhost ([::1]:54224 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dXLoM-00074n-BL for importer@patchew.org; Tue, 18 Jul 2017 02:16:46 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57250) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dXLkY-0003R7-FD for qemu-devel@nongnu.org; Tue, 18 Jul 2017 02:12:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dXLkX-0004QQ-Dq for qemu-devel@nongnu.org; Tue, 18 Jul 2017 02:12:50 -0400 Received: from mail-qk0-x241.google.com ([2607:f8b0:400d:c09::241]:34190) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dXLkU-0004Or-Vt; Tue, 18 Jul 2017 02:12:47 -0400 Received: by mail-qk0-x241.google.com with SMTP id q66so1352354qki.1; Mon, 17 Jul 2017 23:12:46 -0700 (PDT) Received: from yoga.offpageads.com ([138.117.48.223]) by smtp.gmail.com with ESMTPSA id l31sm1099862qtc.64.2017.07.17.23.12.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 17 Jul 2017 23:12:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=cLVdvWrno2IDPvBRRkNyec+Z2xuGvW38qJnyDJn5Tt8=; b=YjaomYsUWTrm5JAsVHZTsRz7OSWKs5x4rOQbXqA+iJK+RjCt2b2L3uHOupgRXFcci4 i3ljX/CzNf63dn7oICkALrD63tNUkaaW7zlmdRA7wsNG7cKmqT9E4jD322ftMIGyzd1c kDK1gwqPi2l7vefFeJcZwI374nQHh98COO8IZf8Gjm9rKiNbCs/YYUm198rmw9RVaFGA lJGlUml6Ylu9yVe2lheG4srqaZqzqXtWa5tz5fpUFmpODJHB1LXNHhLe7G590zvSbAJi alNBqnF1sHhDSd9LjiVKBA9zMlfIt0omTEctrOalHtDBTuOR6NFhSA0/ETVdbbI7yGik AgIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=cLVdvWrno2IDPvBRRkNyec+Z2xuGvW38qJnyDJn5Tt8=; b=FlmmYfNYc9hvvhS1AK5N7I+cOCoOnES91YeHBWoKaeyDI0pfDRiSZwJDqRPJ/K2thm qLdsGa/PsjtTsEGnXs+vop8dfiLcFiZnZCdfR9RiExI0r+gjQXiT1YQeVwrC4twd1qDD I9VzpwZ869sXrh4MNKPf91W5W3q5vpzd8/OuWHNfE8F8riheAbedSnZYMxG7GObS1ghn GH22ZHVfxZkzN9btSbenqscC5jZnbeG702p5W+rwDzFoiF6HhLAh33bC6EHb+spHHVq+ R+/R/n41GnfjzYiNrgdQ5HlBVu4BjQO3q+Rm8B72/iGsY7/3MICz0pquiKCU0Dn+nJoo JEQA== X-Gm-Message-State: AIVw1138HlUS4VA5RyZtjF3Ov0/Sb4DIaDJuuWJhvj2LxqcoFE8hkNOe n3+VEB0B8QIo2cMFQ8UVQA== X-Received: by 10.55.140.71 with SMTP id o68mr99941qkd.18.1500358366217; Mon, 17 Jul 2017 23:12:46 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-trivial@nongnu.org, Kevin Wolf , Max Reitz , Stefan Hajnoczi , Fam Zheng , Juan Quintela , "Dr. David Alan Gilbert" , Jeff Cody Date: Tue, 18 Jul 2017 03:09:41 -0300 Message-Id: <20170718061005.29518-6-f4bug@amsat.org> X-Mailer: git-send-email 2.13.2 In-Reply-To: <20170718061005.29518-1-f4bug@amsat.org> References: <20170718061005.29518-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400d:c09::241 Subject: [Qemu-devel] [PATCH 05/29] block: use QEMU_IS_ALIGNED macro 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: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-block@nongnu.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Applied using the Coccinelle semantic patch scripts/coccinelle/use_osdep.co= cci Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Juan Quintela --- block/io.c | 4 ++-- block/qcow2-cache.c | 2 +- block/vhdx-log.c | 2 +- block/vvfat.c | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/block/io.c b/block/io.c index aece54c015..2db571c310 100644 --- a/block/io.c +++ b/block/io.c @@ -1232,7 +1232,7 @@ static int coroutine_fn bdrv_co_do_pwrite_zeroes(Bloc= kDriverState *bs, int max_transfer =3D MIN_NON_ZERO(bs->bl.max_transfer, MAX_WRITE_ZEROES_BOUNCE_BUFFER); =20 - assert(alignment % bs->bl.request_alignment =3D=3D 0); + assert(QEMU_IS_ALIGNED(alignment, bs->bl.request_alignment)); head =3D offset % alignment; tail =3D (offset + bytes) % alignment; max_write_zeroes =3D QEMU_ALIGN_DOWN(max_write_zeroes, alignment); @@ -2342,7 +2342,7 @@ int coroutine_fn bdrv_co_pdiscard(BlockDriverState *b= s, int64_t offset, * unaligned requests (by returning -ENOTSUP), so we must fragment * the request accordingly. */ align =3D MAX(bs->bl.pdiscard_alignment, bs->bl.request_alignment); - assert(align % bs->bl.request_alignment =3D=3D 0); + assert(QEMU_IS_ALIGNED(align, bs->bl.request_alignment)); head =3D offset % align; tail =3D (offset + bytes) % align; =20 diff --git a/block/qcow2-cache.c b/block/qcow2-cache.c index 1d25147392..a4886c581e 100644 --- a/block/qcow2-cache.c +++ b/block/qcow2-cache.c @@ -58,7 +58,7 @@ static inline int qcow2_cache_get_table_idx(BlockDriverSt= ate *bs, BDRVQcow2State *s =3D bs->opaque; ptrdiff_t table_offset =3D (uint8_t *) table - (uint8_t *) c->table_ar= ray; int idx =3D table_offset / s->cluster_size; - assert(idx >=3D 0 && idx < c->size && table_offset % s->cluster_size = =3D=3D 0); + assert(idx >=3D 0 && idx < c->size && QEMU_IS_ALIGNED(table_offset, s-= >cluster_size)); return idx; } =20 diff --git a/block/vhdx-log.c b/block/vhdx-log.c index 01278f3fc9..bdcaa4cc16 100644 --- a/block/vhdx-log.c +++ b/block/vhdx-log.c @@ -282,7 +282,7 @@ static bool vhdx_log_desc_is_valid(VHDXLogDescriptor *d= esc, } =20 if (desc->signature =3D=3D VHDX_LOG_ZERO_SIGNATURE) { - if (desc->zero_length % VHDX_LOG_SECTOR_SIZE =3D=3D 0) { + if (QEMU_IS_ALIGNED(desc->zero_length, VHDX_LOG_SECTOR_SIZE)) { /* valid */ ret =3D true; } diff --git a/block/vvfat.c b/block/vvfat.c index 4dae790203..5eb827fbd6 100644 --- a/block/vvfat.c +++ b/block/vvfat.c @@ -454,7 +454,7 @@ static direntry_t *create_long_filename(BDRVVVFATState = *s, const char *filename) entry=3Darray_get(&(s->directory),s->directory.next-1-(i/26)); if (i >=3D 2 * length + 2) { entry->name[offset] =3D 0xff; - } else if (i % 2 =3D=3D 0) { + } else if (QEMU_IS_ALIGNED(i, 2)) { entry->name[offset] =3D longname[i / 2] & 0xff; } else { entry->name[offset] =3D longname[i / 2] >> 8; --=20 2.13.2