Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2727598pxa; Tue, 25 Aug 2020 01:15:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxN3gDZZb/KJd4c9gwsS6QCYLuDmXQv4N2WHz99tJtexss+GxRAuJtJwG6qP40ZP90drgUs X-Received: by 2002:a05:6402:b26:: with SMTP id bo6mr9181986edb.104.1598343335029; Tue, 25 Aug 2020 01:15:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598343335; cv=none; d=google.com; s=arc-20160816; b=q2AoKYjBfTvDVgxrEWra94bd+GXegkUjYhXzepjac6CmPZUW5mudz6XJMAVxrKE11o joENbCTrLz8R6jAk8bhnUCIIGrLkkA35d+kf1YEaz/DqHYYs9/wvuvLawT5RJBl9g7cR OXc1LZWMddY+Lk7PG2zQjDnzVSLNe616ndq9dJU3qkbkFLfpTf3VCExOVzU2VmA+qeAM PdWNQNUROUsgVSSnJrq3tHbFuw01xllL2PlP9rUG2LGbme9a0nbqqkzaPK3jAxxQ3rQ9 6UzHAYKbNtOzgq6YXn1wYARKG7Wdvwp5H/PCRBRwRjNJOxN7VCToxMGtvXAo5G8VZ/W9 61gA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :content-language:accept-language:in-reply-to:references:message-id :date:thread-index:thread-topic:subject:cc:to:from; bh=0goLyYDk2QwCWUFr6sKE4t2jFjnznaYg1Rh5j7oE9mI=; b=YkjlGW7sh6vWFURw8DZ8S9D0a/Xifubso74lAYBnxnm021AsGPnuxka0/hzZnGAy5D DyHkS4VmScubnVmvya6+JxFjfBFCA3uqXFtMDnNRw/ujRtQZ5RMN4TwEt4kTtnklUZGa lr95yxHS6P2EZkLwLZ5Mc6OPEV0eRV7JuLLik9Sd0WaJajPLwudop6Q0XbK81jYH3l9y dZ//39/ynpIWVG8hKHFDQOIy2Rj27vrqvwGrihzaDLC4yLDZ6BqN6bnboOLsiGohg7A4 uX/jqo0MWSXOUFEAZNN/x1TFr2EmoNnkhKkLICth5vgk+2aUgIlAZ/pUKp/n/jlWSigu mDaQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=aculab.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bk19si8667833ejb.731.2020.08.25.01.15.12; Tue, 25 Aug 2020 01:15:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=aculab.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725947AbgHYIMM convert rfc822-to-8bit (ORCPT + 99 others); Tue, 25 Aug 2020 04:12:12 -0400 Received: from eu-smtp-delivery-151.mimecast.com ([185.58.86.151]:24552 "EHLO eu-smtp-delivery-151.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726090AbgHYIML (ORCPT ); Tue, 25 Aug 2020 04:12:11 -0400 Received: from AcuMS.aculab.com (156.67.243.126 [156.67.243.126]) (Using TLS) by relay.mimecast.com with ESMTP id uk-mta-223-8bUeqZBEMYG5yIzjTAMYbw-1; Tue, 25 Aug 2020 09:12:06 +0100 X-MC-Unique: 8bUeqZBEMYG5yIzjTAMYbw-1 Received: from AcuMS.Aculab.com (fd9f:af1c:a25b:0:43c:695e:880f:8750) by AcuMS.aculab.com (fd9f:af1c:a25b:0:43c:695e:880f:8750) with Microsoft SMTP Server (TLS) id 15.0.1347.2; Tue, 25 Aug 2020 09:12:05 +0100 Received: from AcuMS.Aculab.com ([fe80::43c:695e:880f:8750]) by AcuMS.aculab.com ([fe80::43c:695e:880f:8750%12]) with mapi id 15.00.1347.000; Tue, 25 Aug 2020 09:12:05 +0100 From: David Laight To: 'Alex Dewar' CC: Greg Kroah-Hartman , "Gustavo A. R. Silva" , "accessrunner-general@lists.sourceforge.net" , "linux-usb@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: RE: [PATCH] usb: atm: don't use snprintf() for sysfs attrs Thread-Topic: [PATCH] usb: atm: don't use snprintf() for sysfs attrs Thread-Index: AQHWemUzoPleWxCDKky1KLXQzyLa5alIeCYw Date: Tue, 25 Aug 2020 08:12:05 +0000 Message-ID: <3e882693bb344424af37d4d35f3db605@AcuMS.aculab.com> References: <20200824222322.22962-1-alex.dewar90@gmail.com> In-Reply-To: <20200824222322.22962-1-alex.dewar90@gmail.com> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.202.205.107] MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=C51A453 smtp.mailfrom=david.laight@aculab.com X-Mimecast-Spam-Score: 0.001 X-Mimecast-Originator: aculab.com Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Alex Dewar > Sent: 24 August 2020 23:23 > kernel/cpu.c: don't use snprintf() for sysfs attrs > > As per the documentation (Documentation/filesystems/sysfs.rst), > snprintf() should not be used for formatting values returned by sysfs. > > In all of these cases, sprintf() suffices as we know that the formatted > strings will be less than PAGE_SIZE in length. Hmmmm.... I much prefer to see bounded string ops. sysfs really ought to be passing through the buffer length. The buffer size should probably be SYSFS_BUF_LEN not PAGE_SIZE (even it happens to typically be the same). If PAGE_SIZE is big (or small) passing a 4k buffer may be more appropriate than a PAGE_SIZE one. David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)