From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1161145AbcLPQu4 (ORCPT ); Fri, 16 Dec 2016 11:50:56 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:34390 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1755261AbcLPQut (ORCPT ); Fri, 16 Dec 2016 11:50:49 -0500 Subject: Re: [patch] KEYS: Fix an error code in request_master_key() From: Mimi Zohar To: Dan Carpenter Cc: David Safford , David Howells , James Morris , "Serge E. Hallyn" , linux-security-module@vger.kernel.org, keyrings@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Date: Fri, 16 Dec 2016 11:50:33 -0500 In-Reply-To: <20161216090827.GA7285@elgon.mountain> References: <20161216090827.GA7285@elgon.mountain> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.12.11 (3.12.11-1.fc21) Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16121616-0020-0000-0000-000000829418 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16121616-0021-0000-0000-000001C63580 Message-Id: <1481907033.17553.78.camel@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2016-12-16_10:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1612050000 definitions=main-1612160260 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Dan, On Fri, 2016-12-16 at 12:08 +0300, Dan Carpenter wrote: > This function has two callers and neither are able to handle a NULL > return. Really, -EINVAL is the correct thing return here anyway. This > fixes some static checker warnings like: > > security/keys/encrypted-keys/encrypted.c:709 encrypted_key_decrypt() > error: uninitialized symbol 'master_key'. > > Fixes: 7e70cb497850 ("keys: add new key-type encrypted") > Signed-off-by: Dan Carpenter Thanks! Mimi > diff --git a/security/keys/encrypted-keys/encrypted.c b/security/keys/encrypted-keys/encrypted.c > index 17a06105ccb6..d7a4969b2dd3 100644 > --- a/security/keys/encrypted-keys/encrypted.c > +++ b/security/keys/encrypted-keys/encrypted.c > @@ -437,7 +437,7 @@ static struct skcipher_request *init_skcipher_req(const u8 *key, > static struct key *request_master_key(struct encrypted_key_payload *epayload, > const u8 **master_key, size_t *master_keylen) > { > - struct key *mkey = NULL; > + struct key *mkey = ERR_PTR(-EINVAL); > > if (!strncmp(epayload->master_desc, KEY_TRUSTED_PREFIX, > KEY_TRUSTED_PREFIX_LEN)) { >