Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3755809pxk; Tue, 29 Sep 2020 05:36:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx/nrJnNL31c6ZiLx/QIjz5EMLEc/0ypezhIVEkLE3nXcWU76eaPN5mYS8hlv+SLfnJKhVe X-Received: by 2002:a50:8523:: with SMTP id 32mr3137245edr.282.1601383014851; Tue, 29 Sep 2020 05:36:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601383014; cv=none; d=google.com; s=arc-20160816; b=X7NmWdLuEQisqpCt4zF5BRnaYND26BRfbxsmNrbaenYs8JigJgvwV22KrYpRfFlQdv lCBTIrytiCKOldIzhnBj9T4iaF9GVwpCNhEZr8d203ELZZMjCRuSyMyzJPmvBW+Tw5p2 lB6A5xJ+bABH2MTYZhvnLMT2NTLE47m9Aw3en2Ke5uWxQR0IPBwpv3iRXjso2jm5moDh EtLldns46Ls6HErM2mZFhI6sQcHIQ9EBAW0IDj5MItT39k0KxMbjIZ17FQW4+UoOaJw7 Px8KxEcwYNN7llg07/qDrBjxYwl/gTHHnzzfpSEVcBNMiy/X54eDmfHyY0xjfrhJqd1q ciKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=fl/Rq7NrgA2HsEreW2SiRR4wp+Th7jMyYXMzinhl/sE=; b=BBDLuatqxlkZtqkJndWdT+BbTKdJAnc9zTbpqg7cu/AgTqb9vrb6ZCEpdbEe9VhOhi JSC6FfWpZymv7L5ORgTim5WLuJD/Ha1NIQXb2LlerU4Hx781pztRs+20kJoqamBUnNrv K5TSbYmmEZ0MgBhKI+j8Pjn/vUc4TYevwOmClWdogylYy45PA7UWueJM4AM3HuPXJHOJ sppvainOM9b3KKIk4ZXxiX4LCHTBdVAF4P7rrZRobT36dXOPCeuKDqlwTDPo3wa7GxX2 KHyoHC6k2jPggkuhhorENMTj+ybJor8AAFvBY5oNrMxhFjJ88JrrcGKAxMNkn0hetsz4 DJKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=IRWKwSRJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i9si2587653eds.610.2020.09.29.05.36.32; Tue, 29 Sep 2020 05:36:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=IRWKwSRJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729331AbgI2Mdi (ORCPT + 99 others); Tue, 29 Sep 2020 08:33:38 -0400 Received: from mail.kernel.org ([198.145.29.99]:37338 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729573AbgI2LW5 (ORCPT ); Tue, 29 Sep 2020 07:22:57 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D20B523A77; Tue, 29 Sep 2020 11:20:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601378421; bh=3Kt5oabK3fLJyocsGGe0a0US7YSU62J2nZ/GWo0wV0g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IRWKwSRJ1qwSZA8wE2ZkqN6Zdfv3vq6m1MPvU+pqbgbU3OiCogbIaBT2SuUzVLkni e2A/6PuI9o9M+rd5jhHPSSOK8cnVgROl2qDFs12MEnCdJw1jFcDxwYQVcnzcVZIrnw wxE4JKUvzVUI2qn46Wep44QxLYmAKqJmL0AX62Ek= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Linus=20L=C3=BCssing?= , Sven Eckelmann , Sasha Levin Subject: [PATCH 4.14 150/166] batman-adv: bla: fix type misuse for backbone_gw hash indexing Date: Tue, 29 Sep 2020 13:01:02 +0200 Message-Id: <20200929105942.684874832@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200929105935.184737111@linuxfoundation.org> References: <20200929105935.184737111@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Linus Lüssing [ Upstream commit 097930e85f90f252c44dc0d084598265dd44ca48 ] It seems that due to a copy & paste error the void pointer in batadv_choose_backbone_gw() is cast to the wrong type. Fixing this by using "struct batadv_bla_backbone_gw" instead of "struct batadv_bla_claim" which better matches the caller's side. For now it seems that we were lucky because the two structs both have their orig/vid and addr/vid in the beginning. However I stumbled over this issue when I was trying to add some debug variables in front of "orig" in batadv_backbone_gw, which caused hash lookups to fail. Fixes: 07568d0369f9 ("batman-adv: don't rely on positions in struct for hashing") Signed-off-by: Linus Lüssing Signed-off-by: Sven Eckelmann Signed-off-by: Sasha Levin --- net/batman-adv/bridge_loop_avoidance.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/net/batman-adv/bridge_loop_avoidance.c b/net/batman-adv/bridge_loop_avoidance.c index ae647fa69ce85..0f1a77d6aa932 100644 --- a/net/batman-adv/bridge_loop_avoidance.c +++ b/net/batman-adv/bridge_loop_avoidance.c @@ -95,11 +95,12 @@ static inline u32 batadv_choose_claim(const void *data, u32 size) */ static inline u32 batadv_choose_backbone_gw(const void *data, u32 size) { - const struct batadv_bla_claim *claim = (struct batadv_bla_claim *)data; + const struct batadv_bla_backbone_gw *gw; u32 hash = 0; - hash = jhash(&claim->addr, sizeof(claim->addr), hash); - hash = jhash(&claim->vid, sizeof(claim->vid), hash); + gw = (struct batadv_bla_backbone_gw *)data; + hash = jhash(&gw->orig, sizeof(gw->orig), hash); + hash = jhash(&gw->vid, sizeof(gw->vid), hash); return hash % size; } -- 2.25.1