From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754363AbdEQPAb (ORCPT ); Wed, 17 May 2017 11:00:31 -0400 Received: from mail-qk0-f173.google.com ([209.85.220.173]:35933 "EHLO mail-qk0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753785AbdEQPA3 (ORCPT ); Wed, 17 May 2017 11:00:29 -0400 MIME-Version: 1.0 In-Reply-To: <1494967240.21557.18.camel@tycho.nsa.gov> References: <1494928281-11128-1-git-send-email-sbuisson@ddn.com> <1494967240.21557.18.camel@tycho.nsa.gov> From: Sebastien Buisson Date: Wed, 17 May 2017 16:59:46 +0200 Message-ID: Subject: Re: [PATCH v5 1/2] selinux: add brief info to policydb To: Stephen Smalley Cc: linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org, selinux@tycho.nsa.gov, serge@hallyn.com, james.l.morris@oracle.com, Eric Paris , Paul Moore , Sebastien Buisson Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 2017-05-16 22:40 GMT+02:00 Stephen Smalley : >> + strcpy(*brief, policydb.policybrief); >> + /* *len is the length of the output string */ >> + *len = policybrief_len - 1; > > Is there a particular reason to not just return policybrief_len here as > well, for consistency in the interface? How do you intend to use this > value in the caller? As called in the other patch to expose policy brief via selinuxfs (sel_read_policybrief), the intent is to provide the caller with the length of the string returned. Or should I set *len to policy brief_len here, and just make the caller aware that the returned length is in fact the length of the buffer (i.e. including terminating NUL byte)? From mboxrd@z Thu Jan 1 00:00:00 1970 From: sbuisson.ddn@gmail.com (Sebastien Buisson) Date: Wed, 17 May 2017 16:59:46 +0200 Subject: [PATCH v5 1/2] selinux: add brief info to policydb In-Reply-To: <1494967240.21557.18.camel@tycho.nsa.gov> References: <1494928281-11128-1-git-send-email-sbuisson@ddn.com> <1494967240.21557.18.camel@tycho.nsa.gov> Message-ID: To: linux-security-module@vger.kernel.org List-Id: linux-security-module.vger.kernel.org 2017-05-16 22:40 GMT+02:00 Stephen Smalley : >> + strcpy(*brief, policydb.policybrief); >> + /* *len is the length of the output string */ >> + *len = policybrief_len - 1; > > Is there a particular reason to not just return policybrief_len here as > well, for consistency in the interface? How do you intend to use this > value in the caller? As called in the other patch to expose policy brief via selinuxfs (sel_read_policybrief), the intent is to provide the caller with the length of the string returned. Or should I set *len to policy brief_len here, and just make the caller aware that the returned length is in fact the length of the buffer (i.e. including terminating NUL byte)? -- To unsubscribe from this list: send the line "unsubscribe linux-security-module" in the body of a message to majordomo at vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html