The branch, master has been updated
       via  164570fcbbe lib/param: clang: Fix 'dereference of a null pointer' 
warning
       via  9c586845665 librpc/ndr: clang: Fix warning 'Value stored to 
'towernum' is never read'
       via  fd17d50f7cb lib/dwrap: Fix 'Null pointer passed as an argument to a 
'nonnull' parameter '
       via  37add5c8ce7 lib/dbwrap: clang: Fix 'all argument is an 
uninitialized value'
       via  1d00bd9f0ba lib/util: clang: Fix Value stored during its 
initialization is never read
       via  cf43f1d052a clang: Fix Null pointer passed as argument warning
       via  7987e4af96b lib/tdb: clang: Fix warning: Dereference of null pointer
      from  e28365c5157 selftest: schema version check in provision test

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 164570fcbbee16a7b42a0adb49c471f198b54a39
Author: Noel Power <[email protected]>
Date:   Fri Jun 14 13:57:59 2019 +0000

    lib/param: clang: Fix 'dereference of a null pointer' warning
    
    Fixes:
    
    lib/param/loadparm.c:3325:36: warning: Access to field 'szService' results 
in a dereference of a null pointer (loaded from variable 'service') <--[clang]
            return lpcfg_string((const char *)service->szService)
    
    Signed-off-by: Noel Power <[email protected]>
    Reviewed-by: Gary Lockyer <[email protected]>
    
    Autobuild-User(master): Noel Power <[email protected]>
    Autobuild-Date(master): Wed Jun 26 11:53:08 UTC 2019 on sn-devel-184

commit 9c586845665b779a698fad98dede42c214cfbff4
Author: Noel Power <[email protected]>
Date:   Fri Jun 14 13:49:47 2019 +0000

    librpc/ndr: clang: Fix warning 'Value stored to 'towernum' is never read'
    
    Fixes:
    
    librpc/ndr/ndr_orpc.c:140:2: warning: Value stored to 'towernum' is never 
read <--[clang]
            towernum = 0;
            ^          ~
    1 warning generated.
    
    Signed-off-by: Noel Power <[email protected]>
    Reviewed-by: Gary Lockyer <[email protected]>

commit fd17d50f7cb8747c66e64e788bbd45212410d9c7
Author: Noel Power <[email protected]>
Date:   Fri Jun 14 13:40:28 2019 +0000

    lib/dwrap: Fix 'Null pointer passed as an argument to a 'nonnull' parameter 
'
    
    Fixes:
    
    lib/dbwrap/dbwrap.c:645:4: warning: Null pointer passed as an argument to a 
'nonnull' parameter <--[clang]
                            memcpy(p, dbufs[i].dptr, thislen);
    
    Signed-off-by: Noel Power <[email protected]>
    Reviewed-by: Gary Lockyer <[email protected]>

commit 37add5c8ce705f9a2d0ab77d6ef07885d72463c7
Author: Noel Power <[email protected]>
Date:   Fri Jun 14 13:36:31 2019 +0000

    lib/dbwrap: clang: Fix 'all argument is an uninitialized value'
    
    Fixes:
    
    lib/dbwrap/dbwrap.c:533:4: warning: 2nd function call argument is an 
uninitialized value <--[clang]
                            dbwrap_lock_order_unlock(db, lockptr);
                            ^
    
    Signed-off-by: Noel Power <[email protected]>
    Reviewed-by: Gary Lockyer <[email protected]>

commit 1d00bd9f0ba7849e98b6a437ef29aeea725b5444
Author: Noel Power <[email protected]>
Date:   Thu Jun 13 18:26:18 2019 +0000

    lib/util: clang: Fix Value stored during its initialization is never read
    
    Fixes:
    
    lib/util/util_tdb.c:385:11: warning: Value stored to 'result' during its 
initialization is never read <--[clang]
    
    Signed-off-by: Noel Power <[email protected]>
    Reviewed-by: Gary Lockyer <[email protected]>

commit cf43f1d052a44bea08bef09ea5eace77143c8093
Author: Noel Power <[email protected]>
Date:   Thu Jun 13 13:39:22 2019 +0000

    clang: Fix Null pointer passed as argument warning
    
    Fixes:
    lib/tdb/common/transaction.c:354:2: warning: Null pointer passed as an 
argument to a 'nonnull' parameter <--[clang]
            memcpy(tdb->transaction->blocks[blk] + off, buf, len);
    &
    
    Signed-off-by: Noel Power <[email protected]>
    Reviewed-by: Gary Lockyer <[email protected]>

commit 7987e4af96b1c2b285834a9d3a9c00b028039737
Author: Noel Power <[email protected]>
Date:   Wed Jun 12 14:55:43 2019 +0000

    lib/tdb: clang: Fix warning: Dereference of null pointer
    
    Fixes:
    
    lib/tdb/common/lock.c:933:6: warning: Dereference of null pointer <--[clang]
            if (tdb->allrecord_lock.count) {
                ^~~~~~~~~~~~~~~~~~~~~~~~~
    
    Signed-off-by: Noel Power <[email protected]>
    Reviewed-by: Gary Lockyer <[email protected]>

-----------------------------------------------------------------------

Summary of changes:
 lib/dbwrap/dbwrap.c          | 7 ++++---
 lib/param/loadparm.c         | 2 +-
 lib/tdb/common/lock.c        | 3 +++
 lib/tdb/common/transaction.c | 2 +-
 lib/util/util_tdb.c          | 5 ++++-
 librpc/ndr/ndr_orpc.c        | 1 -
 6 files changed, 13 insertions(+), 7 deletions(-)


Changeset truncated at 500 lines:

diff --git a/lib/dbwrap/dbwrap.c b/lib/dbwrap/dbwrap.c
index 5e307ee47cd..f8eefcca02d 100644
--- a/lib/dbwrap/dbwrap.c
+++ b/lib/dbwrap/dbwrap.c
@@ -520,7 +520,7 @@ NTSTATUS dbwrap_do_locked(struct db_context *db, TDB_DATA 
key,
        struct db_record *rec;
 
        if (db->do_locked != NULL) {
-               struct db_context **lockptr;
+               struct db_context **lockptr = NULL;
                NTSTATUS status;
 
                if (db->lock_order != DBWRAP_LOCK_ORDER_NONE) {
@@ -529,7 +529,8 @@ NTSTATUS dbwrap_do_locked(struct db_context *db, TDB_DATA 
key,
 
                status = db->do_locked(db, key, fn, private_data);
 
-               if (db->lock_order != DBWRAP_LOCK_ORDER_NONE) {
+               if (db->lock_order != DBWRAP_LOCK_ORDER_NONE &&
+                   lockptr != NULL) {
                        dbwrap_lock_order_unlock(db, lockptr);
                }
 
@@ -641,7 +642,7 @@ static ssize_t tdb_data_buf(const TDB_DATA *dbufs, int 
num_dbufs,
                        return -1;
                }
 
-               if ((thislen != 0) && (needed <= buflen)) {
+               if (p != NULL && (thislen != 0) && (needed <= buflen)) {
                        memcpy(p, dbufs[i].dptr, thislen);
                        p += thislen;
                }
diff --git a/lib/param/loadparm.c b/lib/param/loadparm.c
index e03c1556d7e..169d884ec04 100644
--- a/lib/param/loadparm.c
+++ b/lib/param/loadparm.c
@@ -3322,7 +3322,7 @@ struct loadparm_service *lpcfg_service(struct 
loadparm_context *lp_ctx,
 
 const char *lpcfg_servicename(const struct loadparm_service *service)
 {
-       return lpcfg_string((const char *)service->szService);
+       return service ? lpcfg_string((const char *)service->szService) : NULL;
 }
 
 /**
diff --git a/lib/tdb/common/lock.c b/lib/tdb/common/lock.c
index f55184d8be5..5fba02f9b12 100644
--- a/lib/tdb/common/lock.c
+++ b/lib/tdb/common/lock.c
@@ -927,6 +927,9 @@ int tdb_lock_record(struct tdb_context *tdb, tdb_off_t off)
 int tdb_write_lock_record(struct tdb_context *tdb, tdb_off_t off)
 {
        struct tdb_traverse_lock *i;
+       if (tdb == NULL) {
+               return -1;
+       }
        for (i = &tdb->travlocks; i; i = i->next)
                if (i->off == off)
                        return -1;
diff --git a/lib/tdb/common/transaction.c b/lib/tdb/common/transaction.c
index b67f84f215d..290451b3285 100644
--- a/lib/tdb/common/transaction.c
+++ b/lib/tdb/common/transaction.c
@@ -330,7 +330,7 @@ static int transaction_write_existing(struct tdb_context 
*tdb, tdb_off_t off,
                }
        }
 
-       if (len == 0) {
+       if (len == 0 || buf == NULL) {
                return 0;
        }
 
diff --git a/lib/util/util_tdb.c b/lib/util/util_tdb.c
index 24fb6584899..7b57e83395d 100644
--- a/lib/util/util_tdb.c
+++ b/lib/util/util_tdb.c
@@ -382,7 +382,7 @@ int tdb_traverse_delete_fn(struct tdb_context *the_tdb, 
TDB_DATA key, TDB_DATA d
 
 NTSTATUS map_nt_error_from_tdb(enum TDB_ERROR err)
 {
-       NTSTATUS result = NT_STATUS_INTERNAL_ERROR;
+       NTSTATUS result;
 
        switch (err) {
        case TDB_SUCCESS:
@@ -430,6 +430,9 @@ NTSTATUS map_nt_error_from_tdb(enum TDB_ERROR err)
        case TDB_ERR_NESTING:
                result = NT_STATUS_INTERNAL_ERROR;
                break;
+       default:
+               result = NT_STATUS_INTERNAL_ERROR;
+               break;
        };
        return result;
 }
diff --git a/librpc/ndr/ndr_orpc.c b/librpc/ndr/ndr_orpc.c
index 936a56b5e65..f24ddc5f826 100644
--- a/librpc/ndr/ndr_orpc.c
+++ b/librpc/ndr/ndr_orpc.c
@@ -137,7 +137,6 @@ enum ndr_err_code ndr_pull_STRINGARRAY(struct ndr_pull 
*ndr, int ndr_flags, stru
        } while (towerid != 0);
 
        ar->stringbindings[towernum] = NULL;
-       towernum = 0;
 
        return NDR_ERR_SUCCESS;
 }


-- 
Samba Shared Repository

Reply via email to