break;
}
- if (sscanf(str, "%u%n", &cpt, &n) < 1) {
+ if (sscanf(str, "%d%n", &cpt, &n) < 1) {
CERROR("Invalid cpu pattern %s\n", str);
goto failed;
}
int
libcfs_ip_str2addr(const char *str, int nob, __u32 *addr)
{
- int a;
- int b;
- int c;
- int d;
- int n = nob; /* XscanfX */
+ unsigned int a;
+ unsigned int b;
+ unsigned int c;
+ unsigned int d;
+ int n = nob; /* XscanfX */
/* numeric IP? */
if (sscanf(str, "%u.%u.%u.%u%n", &a, &b, &c, &d, &n) >= 4 &&
libcfs_str2net_internal(const char *str, __u32 *net)
{
struct netstrfns *nf = NULL;
- int nob;
- int netnum;
- int i;
+ int nob;
+ unsigned int netnum;
+ int i;
for (i = 0; i < libcfs_nnetstrfns; i++) {
nf = &libcfs_netstrfns[i];
int cfs_crypto_hash_final(struct cfs_crypto_hash_desc *desc,
unsigned char *hash, unsigned int *hash_len)
{
+ const struct cfs_crypto_hash_type *type;
struct hash_desc *d = (struct hash_desc *)desc;
- int size = (cfs_crypto_hash_type(d->hd_hash->ha_id))->cht_size;
- int err;
+ int size;
+ int err;
+
+ LASSERT(d != NULL);
+ type = cfs_crypto_hash_type(d->hd_hash->ha_id);
+ LASSERT(type != NULL);
+ size = type->cht_size;
if (hash_len == NULL) {
kfree(d);
LASSERT(d->hd_hash->final != NULL);
err = d->hd_hash->final(d->hd_ctx, hash, *hash_len);
if (err == 0) {
- /* If get final digest success free hash descriptor */
- kfree(d);
+ /* If get final digest success free hash descriptor */
+ kfree(d);
}
return err;