From owner-freebsd-wireless@freebsd.org Tue Dec 15 17:56:19 2015 Return-Path: Delivered-To: freebsd-wireless@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 222FEA48D67 for ; Tue, 15 Dec 2015 17:56:19 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-ig0-x230.google.com (mail-ig0-x230.google.com [IPv6:2607:f8b0:4001:c05::230]) (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 E8FAC17DF; Tue, 15 Dec 2015 17:56:18 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: by mail-ig0-x230.google.com with SMTP id mv3so108314514igc.0; Tue, 15 Dec 2015 09:56:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=T9lho5XDbP3jrfIBpdGMFmGSMaFDaIRj7M9F7HGsp0s=; b=yAXIrN4QNxTtl6ZhOzbot8otK6t2iDXd5SfCYuGF5jWnlYJxnFAsF6pl0BRcbExA7M A8KjQnBE6zj7t3ig5AkzId1MFPzpYx6x7Tn2zfvq+bZCGOcNBjQThSXesJXdfm7Z2vPq MIgeVamk0w03/v613xU0Z29sjjqB3S+ciSAp+q3R5akqOFI8mAxRRUf7QNS6GLTNnHnV FPn4dqOkNO3bMsOYqqhSImZCAjfuAhv5oMNs5GN/CbmXloWGpwR6LXepoAxhhxKDnm7l qfwqCoEWAVcLYIlGifKth+bLT6vThu7or7NuhsVxMH93hzpwiTQ4rUCpqsrh7JyxTXYV vI/Q== MIME-Version: 1.0 X-Received: by 10.50.25.169 with SMTP id d9mr5086489igg.61.1450202178310; Tue, 15 Dec 2015 09:56:18 -0800 (PST) Sender: adrian.chadd@gmail.com Received: by 10.36.121.202 with HTTP; Tue, 15 Dec 2015 09:56:18 -0800 (PST) In-Reply-To: References: Date: Tue, 15 Dec 2015 09:56:18 -0800 X-Google-Sender-Auth: ky3VEU-VPwoUKbDZr_XmKSKEIDs Message-ID: Subject: Re: coverity scan results for urtwn From: Adrian Chadd To: Andriy Voskoboinyk Cc: Kevin Lo , "freebsd-wireless@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: freebsd-wireless@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "Discussions of 802.11 stack, tools device driver development." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Dec 2015 17:56:19 -0000 heh, wanna submit a fix? :) -a On 15 December 2015 at 09:55, Andriy Voskoboinyk wrote: >> hiya, >> >> this popped up from the freebsd.org coverity scan: >> >> >> >> ________________________________________________________________________________________________________ >> *** CID 1343338: Memory - illegal accesses (OVERRUN) >> /sys/dev/usb/wlan/if_urtwn.c: 4288 in urtwn_r88e_newassoc() >> 4282 >> 4283 if (!isnew) >> 4284 return; >> 4285 >> 4286 URTWN_NT_LOCK(sc); >> 4287 for (id = 0; id <= URTWN_MACID_MAX(sc); id++) { >>>>> >>>>> CID 1343338: Memory - illegal accesses (OVERRUN) >>>>> Overrunning array "sc->node_list" of 63 8-byte elements at element >>>>> index 63 (byte offset 504) using index "id" (which evaluates to 63). >> >> 4288 if (id != URTWN_MACID_BC && sc->node_list[id] == >> NULL) { >> 4289 un->id = id; >> 4290 sc->node_list[id] = ni; >> 4291 break; >> 4292 } >> 4293 } >> >> Would one of you figure it out? >> >> Thanks! >> >> >> -a > > > #define R88E_MACID_MAX 63 > ... > struct ieee80211_node *node_list[R88E_MACID_MAX]; > > of course, I mean here 64, not 63 (probably, it was a bad idea to replace > first inaccessible element with last accessible).