RE: [v2 PATCH 3/8] Write and read TUNABLE flags in related data structures.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I just realized that I could use the checkpatch.pl in linux source tree to detect any potential whitespace problems in the userspace patches as well. Although we put less strict constraints on the style of userspace patches than kernel patches, it still would be advisable to run checkpatch.pl.

Maybe we could mention this in the "How to Create A Patch Set" section in the wiki of http://oss.tresys.com/projects/refpolicy/wiki/HowToContribute

Thanks,
Harry

> Date: Wed, 7 Sep 2011 17:47:43 -0400
> Subject: Re: [v2 PATCH 3/8] Write and read TUNABLE flags in related data structures.
> From: eparis@xxxxxxxxxxxxxx
> To: qingtao.cao@xxxxxxxxxxxxx
> CC: selinux@xxxxxxxxxxxxx
>
> This patch contained 2 whitespace errors. they have been fixed before
> applying it to my queue branch, however please fix them if there is a
> need to resubmit a v3.
>
> -Eric
>
> On Wed, Aug 31, 2011 at! 11:29 PM, Harry Ciao <qingtao.cao@xxxxxxxxxxxxx> wrote:
> > All flags in cond_bool_datum_t and cond_node_t structures are written
> > or read for policy modules which version is no less than
> > MOD_POLICYDB_VERSION_TUNABLE_SEP.
> >
> > Note, for cond_node_t the TUNABLE flag bit would be used only at expand,
> > however, it won't hurt to read/write this field for modules(potentially
> > for future usage).
> >
> > Signed-off-by: Harry Ciao <qingtao.cao@xxxxxxxxxxxxx>
> > ---
> > álibsepol/src/conditional.c | á 21 +++++++++++++++++++--
> > álibsepol/src/write.c á á á | á 18 ++++++++++++++++++
> > á2 files changed, 37 insertions(+), 2 deletions(-)
> >
> > diff --git a/libsepol/src/conditional.c b/libsepol/src/conditional.c
> > index efdedb0..d9d4fee 100644
> > --- a/libsepol/src/conditional.c
> > ! +++ b/libsepol/src/conditional.c
> > @@ -564,8 +564,8 @@ stat ic int bool_isvalid(cond_bool_datum_t * b)
> > á á á áreturn 1;
> > á}
> >
> > -int cond_read_bool(policydb_t * p
> > - á á á á á á á á á__attribute__ ((unused)), hashtab_t h,
> > +int cond_read_bool(policydb_t * p,
> > + á á á á á á á á áhashtab_t h,
> > á á á á á á á á á struct policy_file *fp)
> > á{
> > á á á áchar *key = 0;
> > @@ -597,6 +597,15 @@ int cond_read_bool(policydb_t * p
> > á á á áif (rc < 0)
> > á á á á á á á ágoto err;
> > á á á ákey[len] = 0;
> > +
> > + á á á if (p->policy_type != POLICY_KERN &&
> > + á á á á á p->policyvers >= MOD_POLICYDB_VERSION_TUNABLE_SEP) {
> > + á á á á á á á rc = next_entry(buf, fp, sizeof(uint32_t));
> > + á á á á á á á if (rc < 0)
> > + á á á á á á ! á á á á á goto err;
> > + á á á á á á á booldatum->flags = le32_to_cpu(buf[0]);
> > + á á á }
> > +
> > á á á áif (hashtab_insert(h, key, booldatum))
> > á á á á á á á ágoto err;
> >
> > @@ -810,6 +819,14 @@ static int cond_read_node(policydb_t * p, cond_node_t * node, void *fp)
> > á á á á á á á áif (avrule_read_list(p, &node->avfalse_list, fp))
> > á á á á á á á á á á á ágoto err;
> > á á á á}
> > +
> > + á á á if (p->policy_type != POLICY_KERN &&
> > + á á á á á p->policyvers >= MOD_POLICYDB_VERSION_TUNABLE_SEP) {
> > + á á á á á á á rc = next_entry(buf, fp, sizeof(uint32_t));
> > + á á á á á á á if (rc < 0)
> > + á á á á á á á á á á á goto err;
> > + á á á á á á á node->flags = le32_to_cpu(buf[0]);!
> > + á á á }
> >
> > á á á áreturn 0;
> > á á á err:
> > diff --git a/libsepol/src/write.c b/libsepol/src/write.c
> > index 290e036..4284c93 100644
> > --- a/libsepol/src/write.c
> > +++ b/libsepol/src/write.c
> > @@ -607,6 +607,7 @@ static int cond_write_bool(hashtab_key_t key, hashtab_datum_t datum, void *ptr)
> > á á á áunsigned int items, items2;
> > á á á ástruct policy_data *pd = ptr;
> > á á á ástruct policy_file *fp = pd->fp;
> > + á á á struct policydb *p = pd->p;
> >
> > á á á ábooldatum = (cond_bool_datum_t *) datum;
> >
> > @@ -621,6 +622,15 @@ static int cond_write_bool(hashtab_key_t key, hashtab_datum_t datum, void *ptr)
> > á á á áitems = put_entry(key, 1, len, fp);
> > á á á áif (items != len)
> > á á á á á á á áreturn POLICYDB_ERROR;
> > +
> > + á á á if (p->policy_type != P! OLICY_KERN &&
> > + á á á á á p->policyvers >= MOD_POLICYDB_VERSION_TUNABLE_SEP) {
> > + á á á á á á á buf[0] = cpu_to_le32(booldatum->flags);
> > + á á á á á á á items = put_entry(buf, sizeof(uint32_t), 1, fp);
> > + á á á á á á á if (items != 1)
> > + á á á á á á á á á á á return POLICYDB_ERROR;
> > + á á á }
> > +
> > á á á áreturn POLICYDB_SUCCESS;
> > á}
> >
> > @@ -727,6 +737,14 @@ static int cond_write_node(policydb_t * p,
> > á á á á á á á á á á á áreturn POLICYDB_ERROR;
> > á á á á}
> >
> > + á á á if (p->policy_type != POLICY_KERN &&
> > + á á á á á p->policyvers >= MOD_POLICYDB_VERSION_TUNABLE_SEP) {
> > + á á á á á á á buf[0] = cpu_to_le32(node->flags);
> > + á á á á á á á items = put_! entry(buf, sizeof(uint32_t), 1, fp);
> > + á á á á á á á if (items != 1)
> > + á á á á á á á á á á á return POLICYDB_ERROR;
> > + á á á }
> > +
> > á á á áreturn POLICYDB_SUCCESS;
> > á}
> >
> > --
> > 1.7.0.4
> >
> >
> > --
> > This message was distributed to subscribers of the selinux mailing list.
> > If you no longer wish to subscribe, send mail to majordomo@xxxxxxxxxxxxx with
> > the words "unsubscribe selinux" without quotes as the message.
> >
>
>
> --
> This message was distributed to subscribers of the selinux mailing list.
> If you no longer wish to subscribe, send mail to majordomo@xxxxxxxxxxxxx with
> the words "unsubscribe selinux" without quotes as the message.

[Index of Archives]     [Selinux Refpolicy]     [Linux SGX]     [Fedora Users]     [Fedora Desktop]     [Yosemite Photos]     [Yosemite Camping]     [Yosemite Campsites]     [KDE Users]     [Gnome Users]

  Powered by Linux