Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp4897628imm; Wed, 30 May 2018 14:23:37 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKIY8CbWT25ZN44QgdsEO14LoMYfzYgnU3oVrpdMEkDCbYEjnMyAfA3BrfvT8O1Dvx2yiAO X-Received: by 2002:a63:3e83:: with SMTP id l125-v6mr3475071pga.355.1527715417381; Wed, 30 May 2018 14:23:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527715417; cv=none; d=google.com; s=arc-20160816; b=JzcaFv8XfTQ+67bpI6nHJEOu8/EfJ5uMD/8yDKTOnMdNcPeRYZekylwTyJi/eVussZ khgZ/fkZiC52wEC3byYB5RtiMVLSQrIblRLZb8QmtMnCdzg2dxF2kKzl2Q9VJ1PcdSTh 3kRag+mnKtXulj5GpxujyTDBwYvut5GPIQdzXeb4Yfq3aHLs4otCtzhl2jKjUVHWgH5p CRWNPX/axFuo5OTHXIAiATRxrfcReLIBOHjsGkuu/QGVAkpJBQ0VlNsrb8V6CHs/rdun TKLlpNiYgrLWjT3XtLWi9QtUz+w2z6cPIxRF3AW4L3pLs/OFWNz3yjx5ghZxlknVxrTF kQtA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:to:subject:dkim-signature :arc-authentication-results; bh=CzYjZsY9RSl6vv2HQ24X2FOCohYBmTz8SjLPks2hs/k=; b=IuOxnq92OaT9kUU72jUXDEvhrTdmFG6FboaCGtRHnXNaCUeOU+wCA3mi7EmWm2YE2R ABCqpBLdf5Iq2CLSf2Ff7D6qEbJlkggiVhwVmOHmMV8qYsLRP3WpBW7a+5bX8Ab7l3oM jvYgyAcQsIZ4q7XFR2+IclC29fgYnJlVmM9XV8k0uAvf8yFo4SK3le7jH07bs+rtHUNC wMo9uQ3pYwL2OPFxGgLgCO2WTy53ugkFRRuAt6SKTAoo+dydvAeSEZV5Hxx7jmqJDMCQ 6/2m0U4vdS4BhkUszAsg8KM73M1VO7LUlLxyGqK3WaI1idyqHUegSSgA966Jvx6+eocz I/xw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=baHke8Xk; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e7-v6si17301281plj.311.2018.05.30.14.23.23; Wed, 30 May 2018 14:23:37 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=baHke8Xk; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932459AbeE3VWs (ORCPT + 99 others); Wed, 30 May 2018 17:22:48 -0400 Received: from mail-pg0-f65.google.com ([74.125.83.65]:32828 "EHLO mail-pg0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932254AbeE3VWo (ORCPT ); Wed, 30 May 2018 17:22:44 -0400 Received: by mail-pg0-f65.google.com with SMTP id e21-v6so8704606pgv.0; Wed, 30 May 2018 14:22:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding:content-language; bh=CzYjZsY9RSl6vv2HQ24X2FOCohYBmTz8SjLPks2hs/k=; b=baHke8XklN93JDrIX7Q5nvGurVJMJZtXn4Xs2QFrwjaUkDC1sPGXuD8WR2r7/kMBNh cJXRiqbE7xbMOgt7q8TzoJOfa3emsGISfqsAPEuFH6AgXNQF7R7WMJvxZdzdOxlheEyu wTp3xmva72PsDmHrD7eVaQ2j1OT3ddUCbRwlKFud8qOuVOTymkZKIGdLDyXEAwzsqaUf PwKPQ+DvY6xdQG0Lr/ORWsHrbl8wOsB2PPIx1faHQ4rVa2AkIb5PdolsIwl0ai5dVn8I GM5N4wdni+qZDPdsQK9HIXLBoKTBgQPFD/t73gmDINShlu2Q9BN1eMW960332sQI+cfi Dsdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=CzYjZsY9RSl6vv2HQ24X2FOCohYBmTz8SjLPks2hs/k=; b=bo1Gxdp64+vux3dNVsHqTr5b+R4ggN/Ss1joTwR9DVgpNcElNTQBtKWs0qF/3U2Q5f f5QA0xJW5bbbbCkZAVVf8Q5H5Q/Tls9gPKXnt6hEhqLctKmYPPS3WTKxVGqxZkCjZ2OM aAl3sYn9e9DogkvrSRoZwsbAVZ2SjuPwEWHJ7mNa0fqbnusaiUSsyVs6MbCSUTUxkawd r1pEcnGTzhEPd8CByQhm+KIbxbjsWvbxdwvqw0h4xYFvaRWjeEnChswbuOwoRRtqxlAC VgpQwNmmxlNWaDK0w77guiwh+ZdD7CpgqwwJ4bnzXV0d4cinPw7kioGjhnTID/UMhSRt naew== X-Gm-Message-State: ALKqPwerWP74V8/91eO+DolI84xnD7M8PdBeMGLzE9sqE9mYbjgc0lSl aQhQBLjMTHnSI9pdrLLJt3I= X-Received: by 2002:a62:c2c7:: with SMTP id w68-v6mr4224944pfk.174.1527715364355; Wed, 30 May 2018 14:22:44 -0700 (PDT) Received: from JF-EN-C02V905BHTDF.tld ([12.111.169.54]) by smtp.gmail.com with ESMTPSA id b3-v6sm31813277pgn.44.2018.05.30.14.22.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 30 May 2018 14:22:43 -0700 (PDT) Subject: Re: [PATCH V3 3/5 selinux-next] selinux: sidtab_clone switch to use rwlock. To: Peter Enderborg , Paul Moore , Stephen Smalley , Eric Paris , James Morris , Daniel Jurgens , Doug Ledford , selinux@tycho.nsa.gov, linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org, "Serge E . Hallyn" , "Paul E . McKenney" References: <20180530141104.28569-1-peter.enderborg@sony.com> <20180530141104.28569-4-peter.enderborg@sony.com> From: J Freyensee Message-ID: Date: Wed, 30 May 2018 14:22:40 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <20180530141104.28569-4-peter.enderborg@sony.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > > +int sidtab_clone(struct sidtab *s, struct sidtab *d) > +{ > + int i, rc = 0; If s or d are NULL (see if() below), why would we want rc, the return value, to be 0?  How about defaulting rc to an error value (-EINVAL)? > + struct sidtab_node *cur; > + > + if (!s || !d) > + goto errout; > + > + read_lock(&s->lock); > + for (i = 0; i < SIDTAB_SIZE; i++) { > + cur = s->htable[i]; > + while (cur) { > + if (cur->sid > SECINITSID_NUM) > + rc = sidtab_insert(d, cur->sid, &cur->context); > + if (rc) > + goto out; > + cur = cur->next; > + } > + } > +out: > + read_unlock(&s->lock); > +errout: > + return rc; > +} > Thanks, Jay