From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753577AbbHFN6E (ORCPT ); Thu, 6 Aug 2015 09:58:04 -0400 Received: from mail-yk0-f172.google.com ([209.85.160.172]:34132 "EHLO mail-yk0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750793AbbHFN6C (ORCPT ); Thu, 6 Aug 2015 09:58:02 -0400 Date: Thu, 6 Aug 2015 09:57:59 -0400 From: Tejun Heo To: NeilBrown Cc: Greg Kroah-Hartman , lkml Subject: Re: [PATCH] sysfs: correctly handle short reads on PREALLOC attrs. Message-ID: <20150806135759.GS17598@mtj.duckdns.org> References: <20150806082755.0b121304@noble> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150806082755.0b121304@noble> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Aug 06, 2015 at 08:27:55AM +1000, NeilBrown wrote: > > > attributes declared with __ATTR_PREALLOC use sysfs_kf_read() > which ignores the 'count' arg. > So a 1-byte read request can return more bytes than that. > > This is seen with the 'dash' shell when 'read' is used on > some 'md' sysfs attributes. > > So only return the 'min' of count and the attribute length. > > Signed-off-by: NeilBrown Acked-by: Tejun Heo Thanks. -- tejun