From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965917AbcA1A6g (ORCPT ); Wed, 27 Jan 2016 19:58:36 -0500 Received: from smtprelay0045.hostedemail.com ([216.40.44.45]:37620 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S935453AbcA1A6c (ORCPT ); Wed, 27 Jan 2016 19:58:32 -0500 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::::::::::::,RULES_HIT:41:355:379:541:599:973:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1437:1515:1516:1518:1534:1540:1593:1594:1711:1730:1747:1777:1792:2393:2553:2559:2562:2828:3138:3139:3140:3141:3142:3352:3622:3865:3866:3867:3868:3870:3871:3872:3874:4321:4470:5007:6261:7807:10004:10400:10848:11026:11232:11658:11914:12043:12438:12517:12519:12740:13069:13161:13229:13311:13357:13894:14659:21080:21212,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:1,LUA_SUMMARY:none X-HE-Tag: root09_675000b256953 X-Filterd-Recvd-Size: 1825 Message-ID: <1453942708.10099.41.camel@perches.com> Subject: Re: [PATCH] lib: fix callers of strtobool to use char array From: Joe Perches To: Kees Cook , linux-kernel@vger.kernel.org Cc: Amitkumar Karwar , Nishant Sarmukadam , Kalle Valo , Steve French , linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-cifs@vger.kernel.org, samba-technical@lists.samba.org Date: Wed, 27 Jan 2016 16:58:28 -0800 In-Reply-To: <20160128004542.GA15247@www.outflux.net> References: <20160128004542.GA15247@www.outflux.net> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.18.3-1ubuntu1 Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 2016-01-27 at 16:45 -0800, Kees Cook wrote: > Some callers of strtobool were passing a pointer to unterminated strings. > This fixes the issue and consolidates some logic in cifs. This may be incomplete as it duplicates the behavior for the old number of characters, but this is not a solution for the entry of a bool that is "on" or "off". > diff --git a/fs/cifs/cifs_debug.c b/fs/cifs/cifs_debug.c [] > @@ -290,7 +305,8 @@ static ssize_t cifs_stats_proc_write(struct file *file, >   } >   } >   spin_unlock(&cifs_tcp_ses_lock); > - } > + } else > + return rc; Likely better to reverse the test and unindent the preceding block. Otherwise, please make sure to use the general brace form of when one branch needs braces, the other branch should have them too.