From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755279AbcECFnK (ORCPT ); Tue, 3 May 2016 01:43:10 -0400 Received: from mail-pf0-f177.google.com ([209.85.192.177]:32854 "EHLO mail-pf0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751066AbcECFnI (ORCPT ); Tue, 3 May 2016 01:43:08 -0400 Date: Tue, 3 May 2016 14:44:42 +0900 From: Sergey Senozhatsky To: Minchan Kim Cc: Sergey Senozhatsky , Sergey Senozhatsky , Andrew Morton , linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/2] zram: user per-cpu compression streams Message-ID: <20160503054442.GB25545@swordfish> References: <1461860230-849-1-git-send-email-sergey.senozhatsky@gmail.com> <1461860230-849-3-git-send-email-sergey.senozhatsky@gmail.com> <20160502062311.GB6077@bbox> <20160502072508.GA1811@swordfish> <20160502080600.GB1811@swordfish> <20160503052324.GB17316@bbox> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160503052324.GB17316@bbox> User-Agent: Mutt/1.6.0 (2016-04-01) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On (05/03/16 14:23), Minchan Kim wrote: [..] > > - zram->max_comp_streams = num; > > - ret = len; > > -out: > > - up_write(&zram->init_lock); > > - return ret; > > At least, we need sanity check code, still? > Otherwise, user can echo "garbage" > /sys/xxx/max_comp_stream" and then > cat /sys/xxx/max_comp_stream returns num_online_cpus. hm, I couldn't find any reason to keep the check. we completely ignore the value anyway, cat /sys/xxx/max_comp_stream will always return num_online_cpus(), regardless the correctness of supplied data; `garbage', `2', `1024', `32' make no difference. -ss