From mboxrd@z Thu Jan 1 00:00:00 1970 From: Joe Perches Subject: Re: [PATCH] cifs: fix erroneous return value Date: Wed, 10 Feb 2016 09:59:46 -0800 Message-ID: <1455127186.3333.44.camel@perches.com> References: <1455126621-28052-1-git-send-email-a.s.protopopov@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: linux-cifs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Anton Protopopov , Steve French Return-path: In-Reply-To: <1455126621-28052-1-git-send-email-a.s.protopopov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> Sender: linux-cifs-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org List-ID: On Wed, 2016-02-10 at 12:50 -0500, Anton Protopopov wrote: > The setup_ntlmv2_rsp() function may return positive value ENOMEM inst= ead > of -ENOMEM in case of kmalloc failure. How have you verified this change is correct? Have you checked that the callers of this function in fs/cifs/sess.c do the appropriate things with with a negative return value? The return value is now set into a struct member variable as a positive value, sess_data->result =3D rc; Have you checked all the users of this member variable? If you have, you should say so in the commit message. > Signed-off-by: Anton Protopopov > --- > =A0fs/cifs/cifsencrypt.c | 2 +- > =A01 file changed, 1 insertion(+), 1 deletion(-) >=20 > diff --git a/fs/cifs/cifsencrypt.c b/fs/cifs/cifsencrypt.c > index afa09fc..e682b36 100644 > --- a/fs/cifs/cifsencrypt.c > +++ b/fs/cifs/cifsencrypt.c > @@ -714,7 +714,7 @@ setup_ntlmv2_rsp(struct cifs_ses *ses, const stru= ct nls_table *nls_cp) > =A0 > =A0 ses->auth_key.response =3D kmalloc(baselen + tilen, GFP_KERNEL); > =A0 if (!ses->auth_key.response) { > - rc =3D ENOMEM; > + rc =3D -ENOMEM; > =A0 ses->auth_key.len =3D 0; > =A0 goto setup_ntlmv2_rsp_ret; > =A0 } From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753022AbcBJR7v (ORCPT ); Wed, 10 Feb 2016 12:59:51 -0500 Received: from smtprelay0143.hostedemail.com ([216.40.44.143]:50809 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752203AbcBJR7t (ORCPT ); Wed, 10 Feb 2016 12:59:49 -0500 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::,RULES_HIT:41:355:379:541:599:800:973:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1431:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2393:2553:2559:2562:2828:2899:3138:3139:3140:3141:3142:3352:3622:3865:3866:3870:3871:3873:3874:4250:4321:5007:6261:7514:10004:10400:10848:11232:11658:11914:12296:12438:12517:12519:12555:12740:13069:13095:13161:13229:13311:13357:13894:14659:21080:30054:30070:30090:30091,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:8,LUA_SUMMARY:none X-HE-Tag: alarm21_1b4faf8326249 X-Filterd-Recvd-Size: 2060 Message-ID: <1455127186.3333.44.camel@perches.com> Subject: Re: [PATCH] cifs: fix erroneous return value From: Joe Perches To: Anton Protopopov , Steve French Cc: linux-cifs@vger.kernel.org, linux-kernel@vger.kernel.org Date: Wed, 10 Feb 2016 09:59:46 -0800 In-Reply-To: <1455126621-28052-1-git-send-email-a.s.protopopov@gmail.com> References: <1455126621-28052-1-git-send-email-a.s.protopopov@gmail.com> 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-02-10 at 12:50 -0500, Anton Protopopov wrote: > The setup_ntlmv2_rsp() function may return positive value ENOMEM instead > of -ENOMEM in case of kmalloc failure. How have you verified this change is correct? Have you checked that the callers of this function in fs/cifs/sess.c do the appropriate things with with a negative return value? The return value is now set into a struct member variable as a positive value, sess_data->result = rc; Have you checked all the users of this member variable? If you have, you should say so in the commit message. > Signed-off-by: Anton Protopopov > --- >  fs/cifs/cifsencrypt.c | 2 +- >  1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/fs/cifs/cifsencrypt.c b/fs/cifs/cifsencrypt.c > index afa09fc..e682b36 100644 > --- a/fs/cifs/cifsencrypt.c > +++ b/fs/cifs/cifsencrypt.c > @@ -714,7 +714,7 @@ setup_ntlmv2_rsp(struct cifs_ses *ses, const struct nls_table *nls_cp) >   >   ses->auth_key.response = kmalloc(baselen + tilen, GFP_KERNEL); >   if (!ses->auth_key.response) { > - rc = ENOMEM; > + rc = -ENOMEM; >   ses->auth_key.len = 0; >   goto setup_ntlmv2_rsp_ret; >   }