From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751543AbbKNPYa (ORCPT ); Sat, 14 Nov 2015 10:24:30 -0500 Received: from mail-wm0-f46.google.com ([74.125.82.46]:34401 "EHLO mail-wm0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751295AbbKNPY1 (ORCPT ); Sat, 14 Nov 2015 10:24:27 -0500 From: Rasmus Villemoes To: Don Brace Cc: Joe Handzik , "James E.J. Bottomley" , Kevin Barnett , Scott Teel , Tomas Henzl , iss_storagedev@hp.com, storagedev@pmcs.com, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] scsi: hpsa: fix multiple issues in path_info_show Organization: D03 References: <1445984203-3288-1-git-send-email-linux@rasmusvillemoes.dk> <56313105.3050805@pmcs.com> X-Hashcash: 1:20:151114:linux-kernel@vger.kernel.org::6fmLKyxNpP9blRkE:00000000000000000000000000000000005kb X-Hashcash: 1:20:151114:scott.teel@pmcs.com::8VdiPyGYlf3hriSC:0000000000000000000000000000000000000000000Ew9 X-Hashcash: 1:20:151114:kevin.barnett@pmcs.com::lc34eP15ervWs+9Z:0000000000000000000000000000000000000001Hvs X-Hashcash: 1:20:151114:storagedev@pmcs.com::Svi5T4WjFy296x8H:00000000000000000000000000000000000000000018Du X-Hashcash: 1:20:151114:jbottomley@odin.com::Eg5kPWpy0pQ3SVeY:0000000000000000000000000000000000000000001xNw X-Hashcash: 1:20:151114:joseph.t.handzik@hp.com::MipZiWwppIc2RC7U:0000000000000000000000000000000000000029dU X-Hashcash: 1:20:151114:brace77070@gmail.com::f2wU1lUcwjnQ7ysw:000000000000000000000000000000000000000005B7b X-Hashcash: 1:20:151114:iss_storagedev@hp.com::xvf1HduXFJlZfZ1u:00000000000000000000000000000000000000007iLp X-Hashcash: 1:20:151114:thenzl@redhat.com::+mhyhaqqIEDR6ElK:000000000000000000000000000000000000000000009ozt X-Hashcash: 1:20:151114:linux-scsi@vger.kernel.org::FdlNgBONbaqrGcAh:000000000000000000000000000000000009Yo+ Date: Sat, 14 Nov 2015 16:24:24 +0100 In-Reply-To: <56313105.3050805@pmcs.com> (Don Brace's message of "Wed, 28 Oct 2015 15:33:09 -0500") Message-ID: <87mvuga9jr.fsf@rasmusvillemoes.dk> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Oct 28 2015, Don Brace wrote: > On 10/27/2015 05:16 PM, Rasmus Villemoes wrote: >> I'm not familiar with this code, but path_info_show() (added in >> 8270b86243658 "hpsa: add sysfs entry path_info to show box and >> bay information") seems to be broken in multiple ways. >> [snip] >> >> We can fix all of that and get rid of the 400 byte stack buffer by >> simply writing directly to the given output buffer, which the upper >> layer guarantees is at least PAGE_SIZE. s[c]nprintf doesn't care where >> it is writing to, so this doesn't make the spin lock hold time any >> longer. Using scnprintf ensures that output_len always represents the >> number of bytes actually written to the buffer, so we'll report the >> proper amount to the upper layer. >> >> Signed-off-by: Rasmus Villemoes >> > Thanks, I added this to my current patch set. This patch will be up > with you as the author soon. I see it in mainline now. May I ask why 6 out of 7 scnprintfs were changed (back) to snprintf? I don't think there's any functional difference as long as PAGE_SIZE is indeed sufficient, but mixing snprintf and scnprintf is pretty odd, and there's now a discrepancy between the commit log and the patch which wasn't in my original - I'd expect a "[use snprintf because xyz]" note added if the change was intentional. Rasmus