Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp235854imm; Wed, 30 May 2018 22:36:02 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJpx2NUuKEsadphquHQKPtncJtw0zmuSuWeCchfs83uO+7Xpg4sBS0FpxwTb8ELInKU1r1K X-Received: by 2002:a62:2281:: with SMTP id p1-v6mr5536514pfj.53.1527744962192; Wed, 30 May 2018 22:36:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527744962; cv=none; d=google.com; s=arc-20160816; b=pp0djSqC+T06iEoC+gWoeHuJt8qWO9FVpXbzzuYaTan2hXAAiW9f4HyXRIws5mCXcJ vqzPZWSsk1cAY2o0kTshjTqVUI21ZUZv2SGZw+DAr4B7WWbEYP09Fov7MIUeOABxiXXI mNA6ytJYnyZlFQyrmp94Uls0Pa4nyBgiy4NXaQWv3bYzNmwQcn8knpON5ZKe3xxtitPL 330KFpSW68WHhxOfFAVv4vvHNHiH+U1kTHHlqoGxIptpktQPEeGxQiJrQxDYUnlv55lZ 5JAL1XXV7OvupG5Byg7drjyj8Rizlo2KRAKF4TEPBbSYZ6hlJIlfEXIhJ3VpVmKi8Q0v KbKQ== 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:arc-authentication-results; bh=/g5ClWqxS+DQ2Mm7zxMNHnTOw3+hX9m8W66EuC+rbYw=; b=TeXkD0VOa+JnRKQF8Ubd8y7b6QPkHHz8XLC2kd748ltBWVPSh3RmRALKPHcnzBiM5g gcWW/jh52dBjxxB5oNXgQO8+gHzcozL/Nw403nmJzsJFbJRy/n+cxPyyQjTIbIOCSKR5 tItcxubkQfhFHb0E2qL4oG9dsh9rUb/n8/OZFA2v+CTIKfnZy+/+oWBpuXHl2X90J0vL 3rnHxamtwOHU1q2MjpvvDgeY1+ZCCDJJ7vG0MYqExpMZa4nXmFPhsFZj4igNZI64L2IX 1Jy0C7AEpIQfCUKvRR9a6uNTWXnVx9IMt+IeEsQ/jMtOlTV6g6nzWna9m2lvZ8DzQGGt JZZA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n125-v6si37033171pfn.352.2018.05.30.22.35.46; Wed, 30 May 2018 22:36:02 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753767AbeEaFfQ convert rfc822-to-8bit (ORCPT + 99 others); Thu, 31 May 2018 01:35:16 -0400 Received: from seldsegrel01.sonyericsson.com ([37.139.156.29]:19160 "EHLO SELDSEGREL01.sonyericsson.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751037AbeEaFfP (ORCPT ); Thu, 31 May 2018 01:35:15 -0400 Subject: Re: [PATCH V3 3/5 selinux-next] selinux: sidtab_clone switch to use rwlock. To: J Freyensee , Paul Moore , Stephen Smalley , Eric Paris , James Morris , Daniel Jurgens , Doug Ledford , , , , "Serge E . Hallyn" , "Paul E . McKenney" References: <20180530141104.28569-1-peter.enderborg@sony.com> <20180530141104.28569-4-peter.enderborg@sony.com> From: peter enderborg Message-ID: <85176be7-360c-d823-c3b5-3651c74ca5a0@sony.com> Date: Thu, 31 May 2018 07:35:12 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8BIT Content-Language: en-GB Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 05/30/2018 11:22 PM, J Freyensee wrote: > >>   +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)? Oops! Thanks, will fix in next set. >> +    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 >