From owner-svn-src-head@freebsd.org Sun Feb 14 15:23:41 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5C8A1AA858B; Sun, 14 Feb 2016 15:23:41 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-ig0-x22e.google.com (mail-ig0-x22e.google.com [IPv6:2607:f8b0:4001:c05::22e]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 293311431; Sun, 14 Feb 2016 15:23:41 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: by mail-ig0-x22e.google.com with SMTP id xg9so37677776igb.1; Sun, 14 Feb 2016 07:23:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=sM/7Ir7DZk9mNY2QfQEJ8Req1BEMqZkVyRpBGLH3pfM=; b=GWlycpE3gW3WuBuuEudud0NyQ3xneZ7GF9hLdsHIw4ONm+/xjM4o9Jtbh6A3JjGAlH YQmQWPriqH1ebaC6EtwKwbAaCPU3rLu0zV4SlFR/xZy3Vp0s2BsOX2XVhBKWKEcL9LIr s7cBy8wO7d2ILpBha1mBxDBRiatd4HxpZ61BtL2Ozmv5++3NseQ8C57rOOMg73Mpur30 LjmaWxghzKpBRJnfDS9eQ3xHjMOsR8u9kuBUpz7FdUEzxZeoFyYBnU2zcqQDIfgxxNyt eMFgn/6SSPrle/27kwg0TViu8MsZaiFtdM8TwPZbHlMVDdsCkwRutRxmJ5jRTVSjKZSy xEuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=sM/7Ir7DZk9mNY2QfQEJ8Req1BEMqZkVyRpBGLH3pfM=; b=OjLA11RF8nNTKnNG3UCQwYIXV+kXo5sjx0slGwcH6v55wnrVvJUBqgovvq4HF1FVJC dhFnzw4cjcX6pCOoTLHKgFMl801YDGnibkQtlwb4U3E+LezPqQYDEl8M1x3UYfTCi33x xM71GRq34mWC1FfuA4Zf1IhcxxyJh0FgVQcoKX9GQKKhIJCXV+aDqJzng0uJRoMM7hB/ 3TroaCpuvxIVQMQzrPz0/RZu9il0xvo/fxzCkknMqG5WU1r/12Zwz2PELhKsjfFVfH43 ZdGNBFt5zhu8Pl5O9an/jxl9eI+6sptBXDCIKtlb4EaLQB88XDGnFfBSdQtcmTR70Nx9 p8cQ== X-Gm-Message-State: AG10YOSQ8qJMVoDBldu++YWZvaNTXAfqsC1pUx9GUEjc9M/4XleRCQsG3zuYFTPLkO6v51FtV6nCNB8+Lpakig== MIME-Version: 1.0 X-Received: by 10.50.79.230 with SMTP id m6mr5461225igx.22.1455463420053; Sun, 14 Feb 2016 07:23:40 -0800 (PST) Received: by 10.36.14.19 with HTTP; Sun, 14 Feb 2016 07:23:40 -0800 (PST) In-Reply-To: <201602140716.u1E7Gaot040504@repo.freebsd.org> References: <201602140716.u1E7Gaot040504@repo.freebsd.org> Date: Sun, 14 Feb 2016 07:23:40 -0800 Message-ID: Subject: Re: svn commit: r295607 - head/sys/dev/usb/wlan From: Adrian Chadd To: Hans Petter Selasky , Andriy Voskoboinyk Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Feb 2016 15:23:41 -0000 uhm, why'd you not just file a separate pr for this? 8 keys limits how many stations it can support in hostap mode :( I'd rather the bitmap management code gets fixed. -a On 13 February 2016 at 23:16, Hans Petter Selasky wrote: > Author: hselasky > Date: Sun Feb 14 07:16:36 2016 > New Revision: 295607 > URL: https://svnweb.freebsd.org/changeset/base/295607 > > Log: > Reduce the number of supported WLAN keys in the rum driver, else we > risk bit shifting overflows. Found by D5245 / PVS. > > MFC after: 1 week > > Modified: > head/sys/dev/usb/wlan/if_rum.c > head/sys/dev/usb/wlan/if_rumreg.h > > Modified: head/sys/dev/usb/wlan/if_rum.c > ============================================================================== > --- head/sys/dev/usb/wlan/if_rum.c Sun Feb 14 02:28:59 2016 (r295606) > +++ head/sys/dev/usb/wlan/if_rum.c Sun Feb 14 07:16:36 2016 (r295607) > @@ -2732,7 +2732,7 @@ rum_pair_key_del_cb(struct rum_softc *sc > DPRINTF("%s: removing key %d\n", __func__, k->wk_keyix); > rum_clrbits(sc, (k->wk_keyix < 32) ? RT2573_SEC_CSR2 : RT2573_SEC_CSR3, > 1 << (k->wk_keyix % 32)); > - sc->keys_bmap &= ~(1 << k->wk_keyix); > + sc->keys_bmap &= ~(1ULL << k->wk_keyix); > if (--sc->vap_key_count[rvp_id] == 0) > rum_clrbits(sc, RT2573_SEC_CSR4, 1 << rvp_id); > } > @@ -2749,8 +2749,8 @@ rum_key_alloc(struct ieee80211vap *vap, > if (!(k->wk_flags & IEEE80211_KEY_SWCRYPT)) { > RUM_LOCK(sc); > for (i = 0; i < RT2573_ADDR_MAX; i++) { > - if ((sc->keys_bmap & (1 << i)) == 0) { > - sc->keys_bmap |= 1 << i; > + if ((sc->keys_bmap & (1ULL << i)) == 0) { > + sc->keys_bmap |= (1ULL << i); > *keyix = i; > break; > } > > Modified: head/sys/dev/usb/wlan/if_rumreg.h > ============================================================================== > --- head/sys/dev/usb/wlan/if_rumreg.h Sun Feb 14 02:28:59 2016 (r295606) > +++ head/sys/dev/usb/wlan/if_rumreg.h Sun Feb 14 07:16:36 2016 (r295607) > @@ -47,7 +47,7 @@ > * H/w encryption/decryption support > */ > #define KEY_SIZE (IEEE80211_KEYBUF_SIZE + IEEE80211_MICBUF_SIZE) > -#define RT2573_ADDR_MAX 64 > +#define RT2573_ADDR_MAX (32 / RT2573_SKEY_MAX) > #define RT2573_SKEY_MAX 4 > > #define RT2573_SKEY(vap, kidx) (0x1000 + ((vap) * RT2573_SKEY_MAX + \ >