From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id +2bLBpHpkmBRCgAAWB0awg (envelope-from ) for ; Wed, 05 May 2021 14:53:05 -0400 Received: by simark.ca (Postfix, from userid 112) id 0DE121F11C; Wed, 5 May 2021 14:53:05 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id CDF821E54D for ; Wed, 5 May 2021 14:53:03 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id BF129383F41D; Wed, 5 May 2021 18:53:02 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BF129383F41D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1620240782; bh=YbUXhDP6lHiady+RV0ap1f7zsWgnnbwS9AjdTH6fAzQ=; h=Date:To:Subject:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=s19k9E7a6ZtgdgJxcsUU5YVDR/pEoBRhPa2+TgyQvLyfNvKT/bVcvWgCGCnSjgZx/ xK9qDHI/+kEFG+trSN8tiRxHL5kgOdZ/ScVRWQW1+G3lsCl3wno+cBWu7etOgcnLmM knk2YMTIh+2Sn6U+srwNjvlV3TUt6cdvfeTF26BA= Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by sourceware.org (Postfix) with ESMTP id 72E7D384F035 for ; Wed, 5 May 2021 18:53:00 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 72E7D384F035 Received: from vapier (localhost [127.0.0.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 84660340E8B; Wed, 5 May 2021 18:52:59 +0000 (UTC) Date: Wed, 5 May 2021 14:52:58 -0400 To: Tom Tromey Subject: Re: [PATCH/committed] sim: rl78: clean up various warnings Message-ID: Mail-Followup-To: Tom Tromey , Mike Frysinger via Gdb-patches References: <20210505030449.25159-1-vapier@gentoo.org> <87k0odqe9w.fsf@tromey.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <87k0odqe9w.fsf@tromey.com> X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Mike Frysinger via Gdb-patches Reply-To: Mike Frysinger Cc: Mike Frysinger via Gdb-patches Errors-To: gdb-patches-bounces@sourceware.org Sender: "Gdb-patches" On 05 May 2021 11:30, Tom Tromey wrote: > >>>>> "Mike" == Mike Frysinger via Gdb-patches writes: > > Mike> Fix a logic error when processing commands where p was reassigned > Mike> to cmd and then has its leading whitespace scanned a 2nd time. > Mike> Handle short reads with fread(). > > Mike> - /* Find the extent of the command word. */ > Mike> - for (p = cmd; *p; p++) > Mike> - if (isspace (*p)) > Mike> - break; > Mike> - > > I'm not sure it makes sense to completely delete this. > Perhaps instead just removing 'p = cmd' is correct? > > It looks to me that this code is trying to parse a command name followed > by arguments. Like, ideally, "monitor trace on" should set cmd="trace" > and args="on", but with the patch I don't think this will happen. you're right that the code is more subtle than i thought. but it's still broken with that tweak. it's broken today too. pretty sure this code has always been wrong and crashes, either from writing to read-only memory, or trying to free an invalid pointer. it basically needs to be gutted. glancing at some other ports (m32c & rx), they have the same bugs, so looks like it started with one bad form, and then copied around. i think replacing it with buildargv is easiest. -mike