From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757391AbbEVNIo (ORCPT ); Fri, 22 May 2015 09:08:44 -0400 Received: from mail-pd0-f171.google.com ([209.85.192.171]:36075 "EHLO mail-pd0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756856AbbEVNIj (ORCPT ); Fri, 22 May 2015 09:08:39 -0400 Date: Fri, 22 May 2015 22:09:01 +0900 From: Sergey Senozhatsky To: Sergey Senozhatsky Cc: Andrew Morton , Minchan Kim , Nitin Gupta , linux-kernel@vger.kernel.org, Sergey Senozhatsky Subject: Re: [PATCH] zram: cut the trailing new-line in algorithm name Message-ID: <20150522130901.GB3793@swordfish> References: <1432287274-7638-1-git-send-email-sergey.senozhatsky@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1432287274-7638-1-git-send-email-sergey.senozhatsky@gmail.com> 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 (05/22/15 18:34), Sergey Senozhatsky wrote: [..] > down_write(&zram->init_lock); > if (init_done(zram)) { > up_write(&zram->init_lock); > @@ -371,6 +378,11 @@ static ssize_t comp_algorithm_store(struct device *dev, > } > strlcpy(zram->compressor, buf, sizeof(zram->compressor)); > up_write(&zram->init_lock); > + > + /* cut the trailing new-line */ > + sz = strlen(zram->compressor) - 1; > + if (zram->compressor[sz] == '\n') > + zram->compressor[sz] = 0x00; oh, how did it escape from the ->init_lock scope... will resend. sorry. -ss