* [bug report] apparmor: add support for mapping secids and using secctxes
@ 2018-05-08 9:39 Dan Carpenter
2018-05-08 17:49 ` John Johansen
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2018-05-08 9:39 UTC (permalink / raw)
To: linux-security-module
Hello John Johansen,
The patch c092921219d2: "apparmor: add support for mapping secids and
using secctxes" from Jul 31, 2017, leads to the following static
checker warning:
security/apparmor/secid.c:162 apparmor_secid_to_secctx()
warn: unsigned '*seclen' is never less than zero.
security/apparmor/secid.c
141 int apparmor_secid_to_secctx(u32 secid, char **secdata, u32 *seclen)
142 {
143 /* TODO: cache secctx and ref count so we don't have to recreate */
144 struct aa_label *label = aa_secid_to_label(secid);
145
146 AA_BUG(!secdata);
147 AA_BUG(!seclen);
148
149 if (!label)
150 return -EINVAL;
151
152 if (secdata)
153 *seclen = aa_label_asxprint(secdata, root_ns, label,
^^^^^^^^^^^^^^^^^
This can return -ENOMEM on error.
154 FLAG_SHOW_MODE | FLAG_VIEW_SUBNS |
155 FLAG_HIDDEN_UNCONFINED |
156 FLAG_ABS_ROOT, GFP_ATOMIC);
157 else
158 *seclen = aa_label_snxprint(NULL, 0, root_ns, label,
159 FLAG_SHOW_MODE | FLAG_VIEW_SUBNS |
160 FLAG_HIDDEN_UNCONFINED |
161 FLAG_ABS_ROOT);
162 if (*seclen < 0)
^^^^^^^^^^^
It's strange that this warning is only showing up now...
163 return -ENOMEM;
164
165 return 0;
166 }
regards,
dan carpenter
--
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@ http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 2+ messages in thread
* [bug report] apparmor: add support for mapping secids and using secctxes
2018-05-08 9:39 [bug report] apparmor: add support for mapping secids and using secctxes Dan Carpenter
@ 2018-05-08 17:49 ` John Johansen
0 siblings, 0 replies; 2+ messages in thread
From: John Johansen @ 2018-05-08 17:49 UTC (permalink / raw)
To: linux-security-module
On 05/08/2018 02:39 AM, Dan Carpenter wrote:
> Hello John Johansen,
>
> The patch c092921219d2: "apparmor: add support for mapping secids and
> using secctxes" from Jul 31, 2017, leads to the following static
> checker warning:
>
> security/apparmor/secid.c:162 apparmor_secid_to_secctx()
> warn: unsigned '*seclen' is never less than zero.
>
> security/apparmor/secid.c
> 141 int apparmor_secid_to_secctx(u32 secid, char **secdata, u32 *seclen)
> 142 {
> 143 /* TODO: cache secctx and ref count so we don't have to recreate */
> 144 struct aa_label *label = aa_secid_to_label(secid);
> 145
> 146 AA_BUG(!secdata);
> 147 AA_BUG(!seclen);
> 148
> 149 if (!label)
> 150 return -EINVAL;
> 151
> 152 if (secdata)
> 153 *seclen = aa_label_asxprint(secdata, root_ns, label,
> ^^^^^^^^^^^^^^^^^
> This can return -ENOMEM on error.
>
> 154 FLAG_SHOW_MODE | FLAG_VIEW_SUBNS |
> 155 FLAG_HIDDEN_UNCONFINED |
> 156 FLAG_ABS_ROOT, GFP_ATOMIC);
> 157 else
> 158 *seclen = aa_label_snxprint(NULL, 0, root_ns, label,
> 159 FLAG_SHOW_MODE | FLAG_VIEW_SUBNS |
> 160 FLAG_HIDDEN_UNCONFINED |
> 161 FLAG_ABS_ROOT);
> 162 if (*seclen < 0)
> ^^^^^^^^^^^
> It's strange that this warning is only showing up now...
>
> 163 return -ENOMEM;
> 164
> 165 return 0;
> 166 }
>
> regards,
> dan carpenter
>
yep sorry the kbuildbot reported this to me back on the 4th and for some reason (probably
distracted) the fix didn't get pushed. It should be there now
thanks
--
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-05-08 17:49 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-05-08 9:39 [bug report] apparmor: add support for mapping secids and using secctxes Dan Carpenter
2018-05-08 17:49 ` John Johansen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).