mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-11-17 01:51:00 +03:00
Cleanup: Remove unnecessary explicit casts of pointers from allocators
The Linux 5.16.14 kernel's coccicheck caught these. The semantic patch that caught them was: ./scripts/coccinelle/api/alloc/alloc_cast.cocci Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Richard Yao <richard.yao@alumni.stonybrook.edu> Closes #14372
This commit is contained in:
parent
80d64bb85f
commit
7384ec65cd
@ -211,7 +211,7 @@ aes_alloc_keysched(size_t *size, int kmflag)
|
|||||||
{
|
{
|
||||||
aes_key_t *keysched;
|
aes_key_t *keysched;
|
||||||
|
|
||||||
keysched = (aes_key_t *)kmem_alloc(sizeof (aes_key_t), kmflag);
|
keysched = kmem_alloc(sizeof (aes_key_t), kmflag);
|
||||||
if (keysched != NULL) {
|
if (keysched != NULL) {
|
||||||
*size = sizeof (aes_key_t);
|
*size = sizeof (aes_key_t);
|
||||||
return (keysched);
|
return (keysched);
|
||||||
|
@ -653,7 +653,7 @@ gcm_init_ctx(gcm_ctx_t *gcm_ctx, char *param, size_t block_size,
|
|||||||
}
|
}
|
||||||
gcm_ctx->gcm_htab_len = htab_len;
|
gcm_ctx->gcm_htab_len = htab_len;
|
||||||
gcm_ctx->gcm_Htable =
|
gcm_ctx->gcm_Htable =
|
||||||
(uint64_t *)kmem_alloc(htab_len, KM_SLEEP);
|
kmem_alloc(htab_len, KM_SLEEP);
|
||||||
|
|
||||||
if (gcm_ctx->gcm_Htable == NULL) {
|
if (gcm_ctx->gcm_Htable == NULL) {
|
||||||
return (CRYPTO_HOST_MEMORY);
|
return (CRYPTO_HOST_MEMORY);
|
||||||
@ -728,7 +728,7 @@ gmac_init_ctx(gcm_ctx_t *gcm_ctx, char *param, size_t block_size,
|
|||||||
}
|
}
|
||||||
gcm_ctx->gcm_htab_len = htab_len;
|
gcm_ctx->gcm_htab_len = htab_len;
|
||||||
gcm_ctx->gcm_Htable =
|
gcm_ctx->gcm_Htable =
|
||||||
(uint64_t *)kmem_alloc(htab_len, KM_SLEEP);
|
kmem_alloc(htab_len, KM_SLEEP);
|
||||||
|
|
||||||
if (gcm_ctx->gcm_Htable == NULL) {
|
if (gcm_ctx->gcm_Htable == NULL) {
|
||||||
return (CRYPTO_HOST_MEMORY);
|
return (CRYPTO_HOST_MEMORY);
|
||||||
|
@ -88,7 +88,7 @@ crypto_create_ctx_template(crypto_mechanism_t *mech, crypto_key_t *key,
|
|||||||
if (error != CRYPTO_SUCCESS)
|
if (error != CRYPTO_SUCCESS)
|
||||||
return (error);
|
return (error);
|
||||||
|
|
||||||
if ((ctx_tmpl = (kcf_ctx_template_t *)kmem_alloc(
|
if ((ctx_tmpl = kmem_alloc(
|
||||||
sizeof (kcf_ctx_template_t), KM_SLEEP)) == NULL) {
|
sizeof (kcf_ctx_template_t), KM_SLEEP)) == NULL) {
|
||||||
KCF_PROV_REFRELE(pd);
|
KCF_PROV_REFRELE(pd);
|
||||||
return (CRYPTO_HOST_MEMORY);
|
return (CRYPTO_HOST_MEMORY);
|
||||||
|
@ -146,7 +146,7 @@ callb_add_common(boolean_t (*func)(void *arg, int code),
|
|||||||
cv_wait(&ct->ct_busy_cv, &ct->ct_lock);
|
cv_wait(&ct->ct_busy_cv, &ct->ct_lock);
|
||||||
if ((cp = ct->ct_freelist) == NULL) {
|
if ((cp = ct->ct_freelist) == NULL) {
|
||||||
ct->ct_ncallb++;
|
ct->ct_ncallb++;
|
||||||
cp = (callb_t *)kmem_zalloc(sizeof (callb_t), KM_SLEEP);
|
cp = kmem_zalloc(sizeof (callb_t), KM_SLEEP);
|
||||||
}
|
}
|
||||||
ct->ct_freelist = cp->c_next;
|
ct->ct_freelist = cp->c_next;
|
||||||
cp->c_thread = t;
|
cp->c_thread = t;
|
||||||
|
@ -701,7 +701,7 @@ spl_kmem_cache_create(const char *name, size_t size, size_t align,
|
|||||||
|
|
||||||
skc->skc_magic = SKC_MAGIC;
|
skc->skc_magic = SKC_MAGIC;
|
||||||
skc->skc_name_size = strlen(name) + 1;
|
skc->skc_name_size = strlen(name) + 1;
|
||||||
skc->skc_name = (char *)kmalloc(skc->skc_name_size, lflags);
|
skc->skc_name = kmalloc(skc->skc_name_size, lflags);
|
||||||
if (skc->skc_name == NULL) {
|
if (skc->skc_name == NULL) {
|
||||||
kfree(skc);
|
kfree(skc);
|
||||||
return (NULL);
|
return (NULL);
|
||||||
|
@ -251,7 +251,7 @@ chksum_benchmark(void)
|
|||||||
/* space for the benchmark times */
|
/* space for the benchmark times */
|
||||||
chksum_stat_cnt = 4;
|
chksum_stat_cnt = 4;
|
||||||
chksum_stat_cnt += blake3_impl_getcnt();
|
chksum_stat_cnt += blake3_impl_getcnt();
|
||||||
chksum_stat_data = (chksum_stat_t *)kmem_zalloc(
|
chksum_stat_data = kmem_zalloc(
|
||||||
sizeof (chksum_stat_t) * chksum_stat_cnt, KM_SLEEP);
|
sizeof (chksum_stat_t) * chksum_stat_cnt, KM_SLEEP);
|
||||||
|
|
||||||
/* edonr - needs to be the first one here (slow CPU check) */
|
/* edonr - needs to be the first one here (slow CPU check) */
|
||||||
|
@ -876,7 +876,7 @@ zfs_get_data(void *arg, uint64_t gen, lr_write_t *lr, char *buf,
|
|||||||
return (SET_ERROR(ENOENT));
|
return (SET_ERROR(ENOENT));
|
||||||
}
|
}
|
||||||
|
|
||||||
zgd = (zgd_t *)kmem_zalloc(sizeof (zgd_t), KM_SLEEP);
|
zgd = kmem_zalloc(sizeof (zgd_t), KM_SLEEP);
|
||||||
zgd->zgd_lwb = lwb;
|
zgd->zgd_lwb = lwb;
|
||||||
zgd->zgd_private = zp;
|
zgd->zgd_private = zp;
|
||||||
|
|
||||||
|
@ -646,7 +646,7 @@ zvol_get_data(void *arg, uint64_t arg2, lr_write_t *lr, char *buf,
|
|||||||
ASSERT3P(zio, !=, NULL);
|
ASSERT3P(zio, !=, NULL);
|
||||||
ASSERT3U(size, !=, 0);
|
ASSERT3U(size, !=, 0);
|
||||||
|
|
||||||
zgd = (zgd_t *)kmem_zalloc(sizeof (zgd_t), KM_SLEEP);
|
zgd = kmem_zalloc(sizeof (zgd_t), KM_SLEEP);
|
||||||
zgd->zgd_lwb = lwb;
|
zgd->zgd_lwb = lwb;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -784,9 +784,9 @@ create_fallback_mem(struct zstd_fallback_mem *mem, size_t size)
|
|||||||
static void __init
|
static void __init
|
||||||
zstd_mempool_init(void)
|
zstd_mempool_init(void)
|
||||||
{
|
{
|
||||||
zstd_mempool_cctx = (struct zstd_pool *)
|
zstd_mempool_cctx =
|
||||||
kmem_zalloc(ZSTD_POOL_MAX * sizeof (struct zstd_pool), KM_SLEEP);
|
kmem_zalloc(ZSTD_POOL_MAX * sizeof (struct zstd_pool), KM_SLEEP);
|
||||||
zstd_mempool_dctx = (struct zstd_pool *)
|
zstd_mempool_dctx =
|
||||||
kmem_zalloc(ZSTD_POOL_MAX * sizeof (struct zstd_pool), KM_SLEEP);
|
kmem_zalloc(ZSTD_POOL_MAX * sizeof (struct zstd_pool), KM_SLEEP);
|
||||||
|
|
||||||
for (int i = 0; i < ZSTD_POOL_MAX; i++) {
|
for (int i = 0; i < ZSTD_POOL_MAX; i++) {
|
||||||
|
Loading…
Reference in New Issue
Block a user