[SSSD] [PATCH] krb5_child: fix value type and initialization

Ondrej Kos okos at redhat.com
Mon Mar 4 10:46:21 UTC 2013


On 03/04/2013 11:02 AM, Pavel Březina wrote:
> On 03/04/2013 10:55 AM, Ondrej Kos wrote:
>> On 03/04/2013 10:32 AM, Sumit Bose wrote:
>>> On Mon, Mar 04, 2013 at 10:12:05AM +0100, Ondrej Kos wrote:
>>>> I noticed the warning while testing another patch.
>>>> --
>>>> Ondrej Kos
>>>> Associate Software Engineer
>>>> Identity Management
>>>> Red Hat Czech
>>>>
>>>> phone: +420-532-294-558
>>>> cell:  +420-736-417-909
>>>> ext:   82-62558
>>>> loc:   1013 Brno 1 office
>>>> irc:   okos @ #sssd #brno
>>>
>>>>  From f483339df40d1b69c0f19720b1802cfec4ede1c1 Mon Sep 17 00:00:00 2001
>>>> From: Ondrej Kos <okos at redhat.com>
>>>> Date: Mon, 4 Mar 2013 10:03:54 +0100
>>>> Subject: [PATCH] krb5_child: fix value type and initialization
>>>>
>>>> ret was defined as integer, instead of errno_t, and was uninitialized
>>>> ---
>>>>   src/providers/krb5/krb5_child.c | 2 +-
>>>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>>>
>>>> diff --git a/src/providers/krb5/krb5_child.c
>>>> b/src/providers/krb5/krb5_child.c
>>>> index
>>>> 9182f2383dd7bcc686d0bcd4dfe696d990bfd150..431d21d1aed4fd93eb7af2b4f713e8affa4f0a4a
>>>>
>>>> 100644
>>>> --- a/src/providers/krb5/krb5_child.c
>>>> +++ b/src/providers/krb5/krb5_child.c
>>>> @@ -1899,7 +1899,7 @@ int main(int argc, const char *argv[])
>>>>       poptContext pc;
>>>>       int debug_fd = -1;
>>>>       int status;
>>>> -    int ret;
>>>> +    errno_t ret = EOK;
>>>
>>> If it is really necessary that a return code is initialized I would
>>> prefer to set it to an error value instead of EOK, to make sure an error
>>> is returned when something unexpected happens.
>>>
>>> In the case here ret is not set if debug_prg_name is NULL due to a
>>> failure of talloc_asprintf(). If you set ret to ENOMEM here, you do not
>>> need to initialize it and the compiler or Coverity can issue a warning
>>> in future if it wasn't set in a new code path.
>>>
>>> bye,
>>> Sumit
>>>>
>>>>       struct poptOption long_options[] = {
>>>>           POPT_AUTOHELP
>>>> --
>>>> 1.8.1.2
>>>>
>>>
>>>> _______________________________________________
>>>> sssd-devel mailing list
>>>> sssd-devel at lists.fedorahosted.org
>>>> https://lists.fedorahosted.org/mailman/listinfo/sssd-devel
>>>
>>> _______________________________________________
>>> sssd-devel mailing list
>>> sssd-devel at lists.fedorahosted.org
>>> https://lists.fedorahosted.org/mailman/listinfo/sssd-devel
>>>
>> thanks, new patch attached
>
> Nack. See Jakub's comment.

I haven't noticed it, and I kind of misunderstood what Sumit was 
proposing, new patch attached.
>
> _______________________________________________
> sssd-devel mailing list
> sssd-devel at lists.fedorahosted.org
> https://lists.fedorahosted.org/mailman/listinfo/sssd-devel


-- 
Ondrej Kos
Associate Software Engineer
Identity Management
Red Hat Czech

phone: +420-532-294-558
cell:  +420-736-417-909
ext:   82-62558
loc:   1013 Brno 1 office
irc:   okos @ #sssd #brno
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-krb5_child-fix-value-type-and-initialization.patch
Type: text/x-patch
Size: 1144 bytes
Desc: not available
URL: <https://lists.fedorahosted.org/pipermail/sssd-devel/attachments/20130304/7501334e/attachment.bin>


More information about the sssd-devel mailing list