John Johansen
52e7128ebb
apparmor: fix '*seclen' is never less than zero
smatch warnings:
security/apparmor/secid.c:162 apparmor_secid_to_secctx() warn: unsigned '*seclen' is never less than zero.
vim +162 security/apparmor/secid.c
140
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,
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)
163 return -ENOMEM;
164
165 return 0;
166 }
167
Fixes: c092921219d2 ("apparmor: add support for mapping secids and using secctxes")
Signed-off-by: John Johansen <john.johansen@canonical.com>
2018-05-08 08:34:08 -07:00
..
2018-05-02 00:48:55 -07:00
2018-03-13 17:25:48 -07:00
2018-04-13 15:38:53 -07:00
2017-06-10 17:11:38 -07:00
2018-02-09 11:30:01 -08:00
2017-04-07 08:58:35 +10:00
2018-05-03 00:47:56 -07:00
2018-03-13 17:25:48 -07:00
2018-02-09 11:30:01 -08:00
2017-01-16 01:18:24 -08:00
2018-05-03 00:49:35 -07:00
2018-05-03 00:49:56 -07:00
2018-05-02 00:49:11 -07:00
2018-03-13 17:25:48 -07:00
2018-05-03 00:50:12 -07:00
2018-05-03 00:50:30 -07:00
2018-03-13 17:25:48 -07:00
2018-02-09 11:30:01 -08:00
2017-06-08 11:29:34 -07:00
2018-02-09 11:30:01 -08:00
2018-03-13 17:25:48 -07:00
2018-05-03 00:50:46 -07:00
2018-02-09 11:30:01 -08:00
2018-02-09 11:30:01 -08:00
2018-05-08 08:34:08 -07:00
2018-02-09 11:30:01 -08:00
2018-02-09 11:30:01 -08:00