From owner-freebsd-current@freebsd.org Tue Jan 12 19:01:41 2021 Return-Path: Delivered-To: freebsd-current@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CBD234E32E3 for ; Tue, 12 Jan 2021 19:01:41 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound5a.ore.mailhop.org (outbound5a.ore.mailhop.org [44.233.67.66]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4DFg0j2hyLz4XDB for ; Tue, 12 Jan 2021 19:01:40 +0000 (UTC) (envelope-from ian@freebsd.org) ARC-Seal: i=1; a=rsa-sha256; t=1610478090; cv=none; d=outbound.mailhop.org; s=arc-outbound20181012; b=aGQKMLlSTEykmy6Juau4My7RoEsKpQ5ubik0KVVScH86g3mjZp2+en2VHU7wsyvXxehPYA049XAbs 9R7Yik9yWNQmnAXhjcj1FRSjmE/23h8yFpMt5MjEH/UDG+B9K4p21w5jgrkno3F6CafsWg6eOaNEhC f3LbYP9ZaAubCS7tZw/otefEh3fkNZ6nVIo7EOKFeVSn7CfdQTf20Z7nhKeuTK+sqKZQKKbklfq8yB dsOhfZ+EiaceuKYhlk4JFX9eqncnfgT6eu6kKMWq6XUVwGA2Y7ICZM+dHEJG0IMBrLhNygP4FIVMsq 6eIFmOsUlvDQe72PvM8pXLkrXmSpK4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=arc-outbound20181012; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:to:from:subject:message-id:dkim-signature:from; bh=eIRNj2OePD4JM0U0gF853nsz6UOZwauWa7L8/z4hqLM=; b=PRNgrn2CIPvd50wLxbsXRyumNctyRnacjyjex1eX1maIc/Y6XV0DF1xthx+/LBNFmHGe4I3dOIgk2 qezOkdqQpRE7kJpja9clj6WjDZW2B5U+6JXJjAiD2fuZ4k8OKhZJOfE86RBrQXFmCy22WpefGWd4jb 5dmTZNkbhFSAJ7ZTPUAWZZDXJjdtbNKPw+nj2Zdia4OnaT2mdoUP25CLrmsH7xn2M2PRLE9zVCdXxd Nsqt4VpRfbSBDYfF0VoKwJDRRCoLbwKLx7xJU7ib/OQ1KVFOYygsEtW64QM6lGgWOmUs4UrlV8quQM mY2r9Rkt2pqqQu+NERHdZ+q2QveXeIQ== ARC-Authentication-Results: i=1; outbound3.ore.mailhop.org; spf=softfail smtp.mailfrom=freebsd.org smtp.remote-ip=67.177.211.60; dmarc=none header.from=freebsd.org; arc=none header.oldest-pass=0; X-MHO-RoutePath: aGlwcGll X-MHO-User: 8dead189-5508-11eb-8ba0-614106969e8d X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Originating-IP: 67.177.211.60 X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (c-67-177-211-60.hsd1.co.comcast.net [67.177.211.60]) by outbound3.ore.mailhop.org (Halon) with ESMTPSA id 8dead189-5508-11eb-8ba0-614106969e8d; Tue, 12 Jan 2021 19:01:22 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id 10CJ1Idj058587; Tue, 12 Jan 2021 12:01:19 -0700 (MST) (envelope-from ian@freebsd.org) Message-ID: Subject: Re: Panic after updating From: Ian Lepore To: Hans Petter Selasky , Jakob Alvermark , FreeBSD Current Date: Tue, 12 Jan 2021 12:01:18 -0700 In-Reply-To: <63efc8ee-cd5b-bf99-bcdd-a49a62c48a63@selasky.org> References: <87512669-f0b9-eb2f-1103-170a29384ea8@alvermark.net> <34a9dafd-9690-1b33-abf8-017ad31cf2ab@alvermark.net> <60e4db60-c816-463e-0e08-a33c674ad4da@alvermark.net> <75784796-b513-5573-abc4-8c445d03c007@selasky.org> <5724744d-7710-4c3c-416b-01314cb196d4@selasky.org> <1bab5b76-eb56-671f-d52d-db1812c9be22@alvermark.net> <7fee78a371dad15e1a7b66eecfa5190e510d930f.camel@freebsd.org> <63efc8ee-cd5b-bf99-bcdd-a49a62c48a63@selasky.org> Content-Type: text/plain; charset="ASCII" X-Mailer: Evolution 3.28.5 FreeBSD GNOME Team Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4DFg0j2hyLz4XDB X-Spamd-Bar: ---- X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jan 2021 19:01:41 -0000 On Tue, 2021-01-12 at 19:56 +0100, Hans Petter Selasky wrote: > On 1/12/21 7:45 PM, Ian Lepore wrote: > > > > - for (int i = 0; i <= sc->sc_npins; i++) { > > > > + for (int i = 0; i != sc->sc_npins; i++) { > > > > mtx_destroy(&sc->sc_pin_intr[i].mtx); > > > > free(&sc->sc_pin_intr[i].pin, M_GPIOC); > > > > } > > > > > > --HPS > > > > > > > If that is the problem, I'd rather see it fixed by using the > > idiomatic > > i < sc->sc_npins rather than the non-standard != test. (But I > > don't > > feel strongly enough about it to learn how to use git and commit > > the > > fix myself.) > > Hi Ian, > > I think it is more serious that the iteration variable is declared > inside the for-loop :-) > > At least it is pretty obvious that the array written is one element > too > small. I've always used != instead of <= in for-loops. But if there > is a > certain style in there, I'm good with < too, though I've always seen > < > as an overhead compared to != , because to implement < you need a > subtraction, while != is just a comparison ... > > --HPS I thought we recently changed (or at least discussed changing) style(9) to allow for that sort of loop-iter-var declaration. On most of the chips I know assembly language for (mostly risc chips), there is no difference between a comparison and a subtraction at the chip-instruction level. That is, at the chip level, comparision instructions are typically implemented as a subtraction that sets condition code bits but doesn't store the result back to a register. -- Ian