Fix k.alloc switched arguments
Subsystems (7)
Joe Perches
maintainercover Fix k.alloc switched arguments
Joe Perches (4):
drivers/gpu/drm/vmwgfx: Fix k.alloc switched arguments drivers/scsi/pmcraid.c: Fix k.alloc switched arguments drivers/staging/udlfb/udlfb.c: Fix k.alloc switched arguments scripts/checkpatch.pl: Add check for k.alloc GFP as first argument
drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c | 2 +- drivers/gpu/drm/vmwgfx/vmwgfx_overlay.c | 2 +- drivers/scsi/pmcraid.c | 4 ++-- drivers/staging/udlfb/udlfb.c | 2 +- scripts/checkpatch.pl | 5 +++++ 5 files changed, 10 insertions(+), 5 deletions(-)
Signature · 1 line
1.7.3.1.g432b3.dirty
Joe Perches
maintainerPATCH 1/4 drivers/gpu/drm/vmwgfx: Fix k.alloc switched arguments
--- drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c | 2 +- drivers/gpu/drm/vmwgfx/vmwgfx_overlay.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c +1 -1
@@ -557,7 +557,7 @@ int vmw_kms_init_legacy_display_system(struct vmw_private *dev_priv)return -EINVAL ; } - dev_priv->ldu_priv =kmalloc (GFP_KERNEL ,sizeof (*dev_priv->ldu_priv)); + dev_priv->ldu_priv =kmalloc (sizeof (*dev_priv->ldu_priv),GFP_KERNEL );if (!dev_priv->ldu_priv)return -ENOMEM ;
drivers/gpu/drm/vmwgfx/vmwgfx_overlay.c +1 -1
@@ -585,7 +585,7 @@ int vmw_overlay_init(struct vmw_private *dev_priv)return -ENOSYS ; } - overlay =kmalloc (GFP_KERNEL ,sizeof (*overlay)); + overlay =kmalloc (sizeof (*overlay),GFP_KERNEL );if (!overlay)return -ENOMEM ;
Signature · 1 line
1.7.3.1.g432b3.dirty
Re: [PATCH 1/4] drivers/gpu/drm/vmwgfx: Fix k.alloc switched arguments
Quoted 33 lines · Joe Perches
Signed-off-by Joe Perches <[email protected]>---
drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c | 2 +-drivers/gpu/drm/vmwgfx/vmwgfx_overlay.c| 2 +-2 files changed, 2 insertions(+), 2 deletions(-)drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c +1
-1@@ -557,7 +557,7 @@ int vmw_kms_init_legacy_display_system(struct vmw_private *dev_priv) return -EINVAL; } - dev_priv->ldu_priv = kmalloc(GFP_KERNEL, sizeof(*dev_priv->ldu_priv)); + dev_priv->ldu_priv = kmalloc(sizeof(*dev_priv->ldu_priv), GFP_KERNEL); if (!dev_priv->ldu_priv) return -ENOMEM;drivers/gpu/drm/vmwgfx/vmwgfx_overlay.c +1
-2@@ -585,7 +585,7 @@ int vmw_overlay_init(struct vmw_private *dev_priv) return -ENOSYS; } - overlay = kmalloc(GFP_KERNEL, sizeof(*overlay)); + overlay = kmalloc(sizeof(*overlay), GFP_KERNEL); if (!overlay) return -ENOMEM; --
Quoted 1 line
1.7.3.1.g432b3.dirty
Oh! That's a bad one.
Thomas Hellstrom
Reviewed-byRe: [PATCH 1/4] drivers/gpu/drm/vmwgfx: Fix k.alloc switched arguments
Quoted 34 lines · Matt Turner
Quoted 32 lines · Joe Perches
Signed-off-by Joe Perches<[email protected]>--- drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c | 2 +- drivers/gpu/drm/vmwgfx/vmwgfx_overlay.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c +1
-1@@ -557,7 +557,7 @@ int vmw_kms_init_legacy_display_system(struct vmw_private *dev_priv)return -EINVAL ; } - dev_priv->ldu_priv =kmalloc (GFP_KERNEL ,sizeof (*dev_priv->ldu_priv)); + dev_priv->ldu_priv =kmalloc (sizeof (*dev_priv->ldu_priv),GFP_KERNEL );if (!dev_priv->ldu_priv)return -ENOMEM ;drivers/gpu/drm/vmwgfx/vmwgfx_overlay.c +1
-1@@ -585,7 +585,7 @@ int vmw_overlay_init(struct vmw_private *dev_priv)return -ENOSYS ; } - overlay =kmalloc (GFP_KERNEL ,sizeof (*overlay)); + overlay =kmalloc (sizeof (*overlay),GFP_KERNEL );if (!overlay)return -ENOMEM ;
Quoted 5 lines
Quoted 3 lines
--
1.7.3.1.g432b3.dirtyOh! That's a bad one.
Indeed.
Quoted 2 lines
Reviewed-by Matt Turner<[email protected]>
Quoted 5 lines
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Joe Perches
maintainerPATCH 2/4 drivers/scsi/pmcraid.c: Fix k.alloc switched arguments
In reply to Joe PerchesAnd a typo fix of faile to failed.
--- drivers/scsi/pmcraid.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/pmcraid.c +2 -2
@@ -4094,10 +4094,10 @@ static long pmcraid_chr_ioctl(struct pmcraid_ioctl_header *hdr =NULL ;int retval = -ENOTTY ; - hdr =kmalloc (GFP_KERNEL ,sizeof (struct pmcraid_ioctl_header )); + hdr =kmalloc (sizeof (struct pmcraid_ioctl_header ),GFP_KERNEL );if (!hdr) { -pmcraid_err ("faile to allocate memory for ioctl header\n" ); +pmcraid_err ("failed to allocate memory for ioctl header\n" );return -ENOMEM ; }
Signature · 1 line
1.7.3.1.g432b3.dirty
Joe Perches
maintainerPATCH RESEND 2/4 drivers/scsi/pmcraid.c: Fix k.alloc switched arguments
In reply to Joe PerchesAnd a typo fix of faile to failed.
--- drivers/scsi/pmcraid.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/pmcraid.c +2 -2
@@ -4094,10 +4094,10 @@ static long pmcraid_chr_ioctl(struct pmcraid_ioctl_header *hdr =NULL ;int retval = -ENOTTY ; - hdr =kmalloc (GFP_KERNEL ,sizeof (struct pmcraid_ioctl_header )); + hdr =kmalloc (sizeof (struct pmcraid_ioctl_header ),GFP_KERNEL );if (!hdr) { -pmcraid_err ("faile to allocate memory for ioctl header\n" ); +pmcraid_err ("failed to allocate memory for ioctl header\n" );return -ENOMEM ; }
Signature · 7 lines
1.7.3.1.g432b3.dirty -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Joe Perches
maintainerPATCH 3/4 drivers/staging/udlfb/udlfb.c: Fix k.alloc switched arguments
In reply to Joe Perches--- drivers/staging/udlfb/udlfb.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/staging/udlfb/udlfb.c +1 -1
@@ -887,7 +887,7 @@ static int dlfb_ops_open(struct fb_info *info, int user)struct fb_deferred_io *fbdefio; - fbdefio =kmalloc (GFP_KERNEL ,sizeof (struct fb_deferred_io )); + fbdefio =kmalloc (sizeof (struct fb_deferred_io ),GFP_KERNEL );if (fbdefio) { fbdefio->delay =DL_DEFIO_WRITE_DELAY ;
Signature · 1 line
1.7.3.1.g432b3.dirty
Joe Perches
maintainerPATCH 4/4 scripts/checkpatch.pl: Add check for k.alloc GFP as first argument
In reply to Joe Perches--- scripts/checkpatch.pl | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-)
scripts/checkpatch.pl +5 -0
@@ -2789,6 +2789,11 @@ sub process { WARN("unnecessary cast may hide bugs, see http://c-faq.com/malloc/mallocnocast.html\n" . $herecurr); } +# check for k.alloc GFP in wrong location + if ($line =~ /\bk[czm]alloc\s*\(\s*\(?\s*GFP_/) { + ERROR("alloc has GFP_<level> as last argument\n" . $herecurr); + } + # check for gcc specific __FUNCTION__ if ($line =~ /__FUNCTION__/) { WARN("__func__ should be used instead of gcc specific __FUNCTION__\n" . $herecurr);
Signature · 1 line
1.7.3.1.g432b3.dirty
Re: [PATCH 4/4] scripts/checkpatch.pl: Add check for k.alloc GFP as first argument
Quoted 10 lines · Joe Perches
Signed-off-by Joe Perches <[email protected]>--- scripts/checkpatch.pl | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-)scripts/checkpatch.pl +0
-0
scripts/checkpatch.pl sub process { · line 2793
Quoted 5 lines
scripts/checkpatch.pl +2
-0@@ -2789,6 +2789,11 @@ sub process { WARN("unnecessary cast may hide bugs, see http://c-faq.com/malloc/mallocnocast.html\n" . $herecurr); } +# check for k.alloc GFP in wrong location + if ($line =~ /\bk[czm]alloc\s*\(\s*\(?\s*GFP_/) {
Just off the top of my head, but shouldn't this check for \s*_*GFP_ in order to catch things like __GFP_ZERO as well?
And what about functions like kmalloc_node()/vmalloc_node() which may also have this problem?
Quoted 7 lines
scripts/checkpatch.pl +3
-0+ ERROR("alloc has GFP_<level> as last argument\n" . $herecurr); + } + # check for gcc specific __FUNCTION__ if ($line =~ /__FUNCTION__/) { WARN("__func__ should be used instead of gcc specific __FUNCTION__\n" . $herecurr);
Signature · 3 lines
Jesper Juhl <[email protected]> http://www.chaosbits.net/ Plain text mails only, please http://www.expita.com/nomime.html Don't top-post http://www.catb.org/~esr/jargon/html/T/top-post.html