From mboxrd@z Thu Jan 1 00:00:00 1970 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.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable 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 9026AC3A5A2 for ; Fri, 23 Aug 2019 08:52:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7000D22CE3 for ; Fri, 23 Aug 2019 08:52:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2393160AbfHWIwf (ORCPT ); Fri, 23 Aug 2019 04:52:35 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:35579 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2393110AbfHWIwf (ORCPT ); Fri, 23 Aug 2019 04:52:35 -0400 Received: from 1.general.cking.uk.vpn ([10.172.193.212] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1i15J8-0006z2-K5; Fri, 23 Aug 2019 08:52:30 +0000 From: Colin King To: Inaky Perez-Gonzalez , linux-wimax@intel.com, "David S . Miller" , netdev@vger.kernel.org Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] wimax/i2400m: fix calculation of index, remove sizeof Date: Fri, 23 Aug 2019 09:52:30 +0100 Message-Id: <20190823085230.6225-1-colin.king@canonical.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Colin Ian King The subtraction of the two pointers is automatically scaled by the size of the size of the object the pointers point to, so the division by sizeof(*i2400m->barker) is incorrect. Fix this by removing the division. Also make index an unsigned int to clean up a checkpatch warning. Addresses-Coverity: ("Extra sizeof expression") Fixes: aba3792ac2d7 ("wimax/i2400m: rework bootrom initialization to be more flexible") Signed-off-by: Colin Ian King --- drivers/net/wimax/i2400m/fw.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/net/wimax/i2400m/fw.c b/drivers/net/wimax/i2400m/fw.c index 489cba9b284d..599a703af6eb 100644 --- a/drivers/net/wimax/i2400m/fw.c +++ b/drivers/net/wimax/i2400m/fw.c @@ -399,8 +399,7 @@ int i2400m_is_boot_barker(struct i2400m *i2400m, * associated with the device. */ if (i2400m->barker && !memcmp(buf, i2400m->barker, sizeof(i2400m->barker->data))) { - unsigned index = (i2400m->barker - i2400m_barker_db) - / sizeof(*i2400m->barker); + unsigned int index = i2400m->barker - i2400m_barker_db; d_printf(2, dev, "boot barker cache-confirmed #%u/%08x\n", index, le32_to_cpu(i2400m->barker->data[0])); return 0; -- 2.20.1