From patchwork Mon May 18 17:38:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 282447 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 11510C433E4 for ; Mon, 18 May 2020 17:40:00 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D6AA12083E for ; Mon, 18 May 2020 17:39:59 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="W1Vt+Lye" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D6AA12083E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=amsat.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:56096 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jajk7-0000Vg-2D for qemu-devel@archiver.kernel.org; Mon, 18 May 2020 13:39:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39680) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jajjF-0007j4-Bw for qemu-devel@nongnu.org; Mon, 18 May 2020 13:39:05 -0400 Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]:42791) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jajjE-0004Wn-Od for qemu-devel@nongnu.org; Mon, 18 May 2020 13:39:05 -0400 Received: by mail-wr1-x443.google.com with SMTP id s8so12854602wrt.9 for ; Mon, 18 May 2020 10:39:04 -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=mNCRmsys8UfNyP+Gk5NUQcKf0vXMp3VyrtqyjiT9EGk=; b=W1Vt+LyedEOvGjoe1n8lBf1KLQUzzncCH8nPPcFQSy6NWZKUZlg8w9UXRSgHAyMIWX Y66rkW0iRZJNd3Kwn7ySaXxk50wpJaNzgWrDEQPgyZTSzHzzrhZrsuaAeARp51j3TgY5 esWIaQqw1U+tdoph1cQVN9ybGBOzcrDIz91gH1a66Z0ok4ORAuOTgegP8YceaUv9w2/2 ygCj/G3YGfIXPP0MDZLXbxcat3N71P33h4lHrCIP6fzTdS0y4zHCd14YZihvBzBdQlA2 rAWq79xsxxiMa52dcW95wE+WGYaYdsKyOfy/++UILo1tSFk5bguBDsBlx6NgrTBLyoIm TVdA== 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=mNCRmsys8UfNyP+Gk5NUQcKf0vXMp3VyrtqyjiT9EGk=; b=csYg/hEsVidPqc56dFyDULZv3Rmi7POFpwzHdTMbLcWI0wtHAFVaHqGKH9nQTBh3NT RaDU8CigzNkdnf7X0izZkbGuIc9BlrAT8D66LMYI3pi9OJq0XnVM3Blp1SV65lhE3A8z gLGRoghl1Bp92vYKYO4FIKAvhPQCcHblfdXwHWsp4EMSZqmdR5ilmyb+tclnqnJpi7fJ I2XQnGNc0d9Ak2j+nYRBYP6eHREpU/qFzwFHlPFjkbHLaA8i4j1FaoIisogOIiCIpaWw LKu08VAQ3wpnmYJXjggRHR450+ECNhFd68WO3glbLTzgDKjl79fsAmhe2hgIaDgpoH7A F+Qg== X-Gm-Message-State: AOAM532Prjv/1tUc/SUvyKso8SVCiaNKvRlwxblW2evmemTtQM9ejX+k hPDEdRh3zIM933oEMO6MpsaTFgT3CrY= X-Google-Smtp-Source: ABdhPJyAyCUm+PB+V8DSq+JA/ZyF6i8I6EJfRaZflQ6Q5ftGilsZvqRhGxVCVGSqxHa0bw266CP3xQ== X-Received: by 2002:a5d:694c:: with SMTP id r12mr20894806wrw.200.1589823542829; Mon, 18 May 2020 10:39:02 -0700 (PDT) Received: from x1w.redhat.com (17.red-88-21-202.staticip.rima-tde.net. [88.21.202.17]) by smtp.gmail.com with ESMTPSA id k13sm271113wmj.40.2020.05.18.10.39.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 May 2020 10:39:02 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v2 1/2] hw/m68k/mcf5206: Reduce m5206_mbar_read/write() offset arg to 16-bit Date: Mon, 18 May 2020 19:38:58 +0200 Message-Id: <20200518173859.16520-2-f4bug@amsat.org> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20200518173859.16520-1-f4bug@amsat.org> References: <20200518173859.16520-1-f4bug@amsat.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::443; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wr1-x443.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.001, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Huth , Jason Wang , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Thomas Huth Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" All calls to m5206_mbar_read/m5206_mbar_write are used with 'offset = hwaddr & 0x3ff', so we are sure the offset fits in 16-bit. Suggested-by: Thomas Huth Signed-off-by: Philippe Mathieu-Daudé --- hw/m68k/mcf5206.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hw/m68k/mcf5206.c b/hw/m68k/mcf5206.c index b155dd8170..45f44c43f0 100644 --- a/hw/m68k/mcf5206.c +++ b/hw/m68k/mcf5206.c @@ -273,7 +273,7 @@ static void m5206_mbar_reset(m5206_mbar_state *s) } static uint64_t m5206_mbar_read(m5206_mbar_state *s, - uint64_t offset, unsigned size) + uint16_t offset, unsigned size) { if (offset >= 0x100 && offset < 0x120) { return m5206_timer_read(s->timer[0], offset - 0x100); @@ -306,11 +306,11 @@ static uint64_t m5206_mbar_read(m5206_mbar_state *s, case 0x170: return s->uivr[0]; case 0x1b0: return s->uivr[1]; } - hw_error("Bad MBAR read offset 0x%x", (int)offset); + hw_error("Bad MBAR read offset 0x%x", offset); return 0; } -static void m5206_mbar_write(m5206_mbar_state *s, uint32_t offset, +static void m5206_mbar_write(m5206_mbar_state *s, uint16_t offset, uint64_t value, unsigned size) { if (offset >= 0x100 && offset < 0x120) { @@ -360,7 +360,7 @@ static void m5206_mbar_write(m5206_mbar_state *s, uint32_t offset, s->uivr[1] = value; break; default: - hw_error("Bad MBAR write offset 0x%x", (int)offset); + hw_error("Bad MBAR write offset 0x%x", offset); break; } }