From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2C1E4C433F5 for ; Thu, 21 Apr 2022 06:10:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1384678AbiDUGNm (ORCPT ); Thu, 21 Apr 2022 02:13:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51692 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232573AbiDUGNm (ORCPT ); Thu, 21 Apr 2022 02:13:42 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C59CD13CDF for ; Wed, 20 Apr 2022 23:10:50 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 34E2561733 for ; Thu, 21 Apr 2022 06:10:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1BF19C385A1; Thu, 21 Apr 2022 06:10:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1650521449; bh=QLsNFQ4xM5/AkErCSSEUoAreJjanQtibM1TiBR3jXvI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=n6z5CECVL7MWZ/MmC9wWPVZu2Rl3hl6tNAYBE25o6ybeiz5NjpKPI1wVmziqTo7jU LJKWsMH4cToOy96UBff9i3+B6/U/vtvITsbuCFkFjVnYRL5/fDajRvmM+P17EeyBZr XRQZD46uZ+27MouqyAl8/mIV9y0diW10cWoYxntw= Date: Thu, 21 Apr 2022 08:10:46 +0200 From: Greg Kroah-Hartman To: Sergey Shtylyov Cc: linux-usb@vger.kernel.org Subject: Re: [PATCH] usb: core: devices: use scnprintf() instead of sprintf() Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org On Wed, Apr 20, 2022 at 11:04:00PM +0300, Sergey Shtylyov wrote: > Hello! > > On 4/20/22 9:40 AM, Greg Kroah-Hartman wrote: > > Thanks for the (unusually?) prompt reply! :-) > > >> The USB device dump code uses the sprintf() calls with a 2-page buffer, > >> leaving 256 bytes at the end of that buffer to prevent buffer overflow. > >> Using scnprntf() instead eliminates the very possibility of the buffer > >> overflow, while also simplifying the code. This however is achieved at > >> the expense of not printing the "(truncated)" line anymore when the end > >> of that buffer is actually reached; instead a possible partial line at > >> the end of buffer (not ending with '\n') is now not printed. > > > > So you just changed a user-visable abi :( > > debugfs is an ABI too? :-) When we have tools that we know parse it, yes it can be. But here you are just changing the existing format for no good reason, which is generally considered a bad thing. thanks, greg k-h