linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] s390: fix invalid kmalloc flags
@ 2005-08-06  0:26 benoit.boissinot
  2005-08-06  0:36 ` Andrew Morton
  0 siblings, 1 reply; 5+ messages in thread
From: benoit.boissinot @ 2005-08-06  0:26 UTC (permalink / raw)
  To: schwidefsky; +Cc: Andrew Morton, linux-kernel

The following patch fixes the compilation (defconfig) of s390:

arch/s390/mm/built-in.o(.text+0x152c): In function `query_segment_type':
extmem.c: undefined reference to `__your_kmalloc_flags_are_not_valid'
arch/s390/mm/built-in.o(.text+0x19ec): In function `segment_load':
: undefined reference to `__your_kmalloc_flags_are_not_valid'


Signed-off-by: Benoit Boissinot <benoit.boissinot@ens-lyon.org>

--- a/arch/s390/mm/extmem.c	2005-08-06 01:32:56.000000000 +0200
+++ b/arch/s390/mm/extmem.c	2005-07-31 17:46:36.000000000 +0200
@@ -172,8 +172,8 @@ dcss_diag_translate_rc (int vm_rc) {
 static int
 query_segment_type (struct dcss_segment *seg)
 {
-	struct qin64  *qin = kmalloc (sizeof(struct qin64), GFP_DMA);
-	struct qout64 *qout = kmalloc (sizeof(struct qout64), GFP_DMA);
+	struct qin64  *qin = kmalloc (sizeof(struct qin64), GFP_DMA|GFP_KERNEL);
+	struct qout64 *qout = kmalloc (sizeof(struct qout64), GFP_DMA|GFP_KERNEL);
 
 	int diag_cc, rc, i;
 	unsigned long dummy, vmrc;
@@ -332,7 +332,7 @@ static int
 __segment_load (char *name, int do_nonshared, unsigned long *addr, unsigned long *end)
 {
 	struct dcss_segment *seg = kmalloc(sizeof(struct dcss_segment),
-			GFP_DMA);
+			GFP_DMA|GFP_KERNEL);
 	int dcss_command, rc, diag_cc;
 
 	if (seg == NULL) {

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] s390: fix invalid kmalloc flags
  2005-08-06  0:26 [PATCH] s390: fix invalid kmalloc flags benoit.boissinot
@ 2005-08-06  0:36 ` Andrew Morton
  2005-08-06  2:00   ` Benjamin LaHaise
  0 siblings, 1 reply; 5+ messages in thread
From: Andrew Morton @ 2005-08-06  0:36 UTC (permalink / raw)
  To: benoit.boissinot; +Cc: schwidefsky, linux-kernel, Benjamin LaHaise

benoit.boissinot@ens-lyon.fr wrote:
>
> The following patch fixes the compilation (defconfig) of s390:
> 
>  arch/s390/mm/built-in.o(.text+0x152c): In function `query_segment_type':
>  extmem.c: undefined reference to `__your_kmalloc_flags_are_not_valid'
>  arch/s390/mm/built-in.o(.text+0x19ec): In function `segment_load':
>  : undefined reference to `__your_kmalloc_flags_are_not_valid'
> 
> 
>  Signed-off-by: Benoit Boissinot <benoit.boissinot@ens-lyon.org>
> 
>  --- a/arch/s390/mm/extmem.c	2005-08-06 01:32:56.000000000 +0200
>  +++ b/arch/s390/mm/extmem.c	2005-07-31 17:46:36.000000000 +0200
>  @@ -172,8 +172,8 @@ dcss_diag_translate_rc (int vm_rc) {
>   static int
>   query_segment_type (struct dcss_segment *seg)
>   {
>  -	struct qin64  *qin = kmalloc (sizeof(struct qin64), GFP_DMA);
>  -	struct qout64 *qout = kmalloc (sizeof(struct qout64), GFP_DMA);
>  +	struct qin64  *qin = kmalloc (sizeof(struct qin64), GFP_DMA|GFP_KERNEL);
>  +	struct qout64 *qout = kmalloc (sizeof(struct qout64), GFP_DMA|GFP_KERNEL);

No, GFP_DMA should work OK.  Except GFP_DMA doesn't have __GFP_VALID set. 
It's strange that this didn't get noticed earlier.

Ben, was there a reason for not giving GFP_DMA the treatment?

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] s390: fix invalid kmalloc flags
  2005-08-06  0:36 ` Andrew Morton
@ 2005-08-06  2:00   ` Benjamin LaHaise
  2005-08-06  2:05     ` Andrew Morton
  0 siblings, 1 reply; 5+ messages in thread
From: Benjamin LaHaise @ 2005-08-06  2:00 UTC (permalink / raw)
  To: Andrew Morton; +Cc: benoit.boissinot, schwidefsky, linux-kernel

On Fri, Aug 05, 2005 at 05:36:29PM -0700, Andrew Morton wrote:
> No, GFP_DMA should work OK.  Except GFP_DMA doesn't have __GFP_VALID set. 
> It's strange that this didn't get noticed earlier.
> 
> Ben, was there a reason for not giving GFP_DMA the treatment?

Not really.  Traditionally GFP_DMA was always mixed in with GFP_KERNEL or 
GFP_ATOMIC.  It seems that GFP_DMA wasn't in the hunk of defines that all 
the other kernel flags were in, so if GFP_DMA is really valid all by itself, 
adding in the __GFP_VALID should be okay.

		-ben
-- 
"Time is what keeps everything from happening all at once." -- John Wheeler

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] s390: fix invalid kmalloc flags
  2005-08-06  2:00   ` Benjamin LaHaise
@ 2005-08-06  2:05     ` Andrew Morton
  2005-08-06  9:15       ` [PATCH] fix invalid kmalloc flags (GFP_DMA alone) Benoit Boissinot
  0 siblings, 1 reply; 5+ messages in thread
From: Andrew Morton @ 2005-08-06  2:05 UTC (permalink / raw)
  To: Benjamin LaHaise; +Cc: benoit.boissinot, schwidefsky, linux-kernel

Benjamin LaHaise <bcrl@kvack.org> wrote:
>
> On Fri, Aug 05, 2005 at 05:36:29PM -0700, Andrew Morton wrote:
> > No, GFP_DMA should work OK.  Except GFP_DMA doesn't have __GFP_VALID set. 
> > It's strange that this didn't get noticed earlier.
> > 
> > Ben, was there a reason for not giving GFP_DMA the treatment?
> 
> Not really.  Traditionally GFP_DMA was always mixed in with GFP_KERNEL or 
> GFP_ATOMIC.  It seems that GFP_DMA wasn't in the hunk of defines that all 
> the other kernel flags were in, so if GFP_DMA is really valid all by itself, 
> adding in the __GFP_VALID should be okay.
> 

OK, it seems that pretty much all callers do remember to add GFP_KERNEL so
I guess we can treat this as a bug-which-ben's-patch-found and merge
Benoit's fix.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] fix invalid kmalloc flags (GFP_DMA alone)
  2005-08-06  2:05     ` Andrew Morton
@ 2005-08-06  9:15       ` Benoit Boissinot
  0 siblings, 0 replies; 5+ messages in thread
From: Benoit Boissinot @ 2005-08-06  9:15 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Benjamin LaHaise, schwidefsky, linux-kernel

On Fri, Aug 05, 2005 at 07:05:00PM -0700, Andrew Morton wrote:
> Benjamin LaHaise <bcrl@kvack.org> wrote:
> >
> > On Fri, Aug 05, 2005 at 05:36:29PM -0700, Andrew Morton wrote:
> > > No, GFP_DMA should work OK.  Except GFP_DMA doesn't have __GFP_VALID set. 
> > > It's strange that this didn't get noticed earlier.
> > > 
> > > Ben, was there a reason for not giving GFP_DMA the treatment?
> > 
> > Not really.  Traditionally GFP_DMA was always mixed in with GFP_KERNEL or 
> > GFP_ATOMIC.  It seems that GFP_DMA wasn't in the hunk of defines that all 
> > the other kernel flags were in, so if GFP_DMA is really valid all by itself, 
> > adding in the __GFP_VALID should be okay.
> > 
> 
> OK, it seems that pretty much all callers do remember to add GFP_KERNEL so
> I guess we can treat this as a bug-which-ben's-patch-found and merge
> Benoit's fix.

The following patch should catch all the other calls with GFP_DMA and
without either GFP_KERNEL or GFP_ATOMIC.
I didn't included the previous patch (for arch/s390/mm/extmem.c).

Signed-off-by: Benoit Boissinot <benoit.boissinot@ens-lyon.org>


diff -urp -X other/Documentation/dontdiff truc/arch/s390/appldata/appldata_os.c other/arch/s390/appldata/appldata_os.c
--- truc/arch/s390/appldata/appldata_os.c	2005-08-06 02:13:50.000000000 +0200
+++ other/arch/s390/appldata/appldata_os.c	2005-08-06 09:26:53.000000000 +0200
@@ -194,7 +194,7 @@ static int __init appldata_os_init(void)
 	P_DEBUG("sizeof(os) = %i, sizeof(os_cpu) = %lu\n", size,
 		sizeof(struct appldata_os_per_cpu));
 
-	appldata_os_data = kmalloc(size, GFP_DMA);
+	appldata_os_data = kmalloc(size, GFP_DMA|GFP_KERNEL);
 	if (appldata_os_data == NULL) {
 		P_ERROR("No memory for %s!\n", ops.name);
 		rc = -ENOMEM;
diff -urp -X other/Documentation/dontdiff truc/drivers/net/b44.c other/drivers/net/b44.c
--- truc/drivers/net/b44.c	2005-08-06 02:14:41.000000000 +0200
+++ other/drivers/net/b44.c	2005-08-06 09:40:10.000000000 +0200
@@ -632,7 +632,7 @@ static int b44_alloc_rx_skb(struct b44 *
 		/* Sigh... */
 		pci_unmap_single(bp->pdev, mapping, RX_PKT_BUF_SZ,PCI_DMA_FROMDEVICE);
 		dev_kfree_skb_any(skb);
-		skb = __dev_alloc_skb(RX_PKT_BUF_SZ,GFP_DMA);
+		skb = __dev_alloc_skb(RX_PKT_BUF_SZ,GFP_ATOMIC|GFP_DMA);
 		if (skb == NULL)
 			return -ENOMEM;
 		mapping = pci_map_single(bp->pdev, skb->data,
diff -urp -X other/Documentation/dontdiff truc/drivers/net/wireless/hostap/hostap_hw.c other/drivers/net/wireless/hostap/hostap_hw.c
--- truc/drivers/net/wireless/hostap/hostap_hw.c	2005-08-06 02:14:41.000000000 +0200
+++ other/drivers/net/wireless/hostap/hostap_hw.c	2005-08-06 09:58:22.000000000 +0200
@@ -3308,7 +3308,7 @@ prism2_init_local_data(struct prism2_hel
 
 #if defined(PRISM2_PCI) && defined(PRISM2_BUS_MASTER)
 	local->bus_m0_buf = (u8 *) kmalloc(sizeof(struct hfa384x_tx_frame) +
-					   PRISM2_DATA_MAXLEN, GFP_DMA);
+					   PRISM2_DATA_MAXLEN, GFP_ATOMIC|GFP_DMA);
 	if (local->bus_m0_buf == NULL)
 		goto fail;
 #endif /* PRISM2_PCI and PRISM2_BUS_MASTER */
diff -urp -X other/Documentation/dontdiff truc/drivers/s390/net/claw.c other/drivers/s390/net/claw.c
--- truc/drivers/s390/net/claw.c	2005-08-06 02:14:41.000000000 +0200
+++ other/drivers/s390/net/claw.c	2005-08-06 10:18:19.000000000 +0200
@@ -2198,7 +2198,7 @@ init_ccw_bk(struct net_device *dev)
         */
         if (privptr->p_buff_ccw==NULL) {
                 privptr->p_buff_ccw=
-			(void *)__get_free_pages(__GFP_DMA,
+			(void *)__get_free_pages(__GFP_DMA|GFP_KERNEL,
 		        (int)pages_to_order_of_mag(ccw_pages_required ));
                 if (privptr->p_buff_ccw==NULL) {
                         printk(KERN_INFO "%s: %s()  "
@@ -2354,7 +2354,7 @@ init_ccw_bk(struct net_device *dev)
         if (privptr->p_buff_write==NULL) {
             if (privptr->p_env->write_size < PAGE_SIZE) {
                 privptr->p_buff_write=
-			(void *)__get_free_pages(__GFP_DMA,
+			(void *)__get_free_pages(__GFP_DMA|GFP_KERNEL,
 			(int)pages_to_order_of_mag(claw_write_pages ));
                 if (privptr->p_buff_write==NULL) {
                         printk(KERN_INFO "%s: %s() __get_free_pages for write"
@@ -2413,7 +2413,7 @@ init_ccw_bk(struct net_device *dev)
            {
                privptr->p_write_free_chain=NULL;
                for (i = 0; i< privptr->p_env->write_buffers ; i++) {
-                   p_buff=(void *)__get_free_pages(__GFP_DMA,
+                   p_buff=(void *)__get_free_pages(__GFP_DMA|GFP_KERNEL,
 		        (int)pages_to_order_of_mag(
 			privptr->p_buff_pages_perwrite) );
 #ifdef IOTRACE
@@ -2489,7 +2489,7 @@ init_ccw_bk(struct net_device *dev)
         if (privptr->p_buff_read==NULL) {
             if (privptr->p_env->read_size < PAGE_SIZE)  {
                 privptr->p_buff_read=
-			(void *)__get_free_pages(__GFP_DMA,
+			(void *)__get_free_pages(__GFP_DMA|GFP_KERNEL,
 			(int)pages_to_order_of_mag(claw_read_pages) );
                 if (privptr->p_buff_read==NULL) {
                         printk(KERN_INFO "%s: %s() "
@@ -2603,7 +2603,7 @@ init_ccw_bk(struct net_device *dev)
 		dev->name,__FUNCTION__);
 #endif
                 for (i=0 ; i< privptr->p_env->read_buffers ; i++) {
-                        p_buff = (void *)__get_free_pages(__GFP_DMA,
+                        p_buff = (void *)__get_free_pages(__GFP_DMA|GFP_KERNEL,
 				(int)pages_to_order_of_mag(privptr->p_buff_pages_perread) );
                         if (p_buff==NULL) {
                                 printk(KERN_INFO "%s: %s() __get_free_pages for read "
diff -urp -X other/Documentation/dontdiff truc/drivers/scsi/pluto.c other/drivers/scsi/pluto.c
--- truc/drivers/scsi/pluto.c	2005-08-06 02:14:41.000000000 +0200
+++ other/drivers/scsi/pluto.c	2005-08-06 10:26:21.000000000 +0200
@@ -116,7 +116,7 @@ int __init pluto_detect(Scsi_Host_Templa
 #endif
 			return 0;
 	}
-	fcs = (struct ctrl_inquiry *) kmalloc (sizeof (struct ctrl_inquiry) * fcscount, GFP_DMA);
+	fcs = (struct ctrl_inquiry *) kmalloc (sizeof (struct ctrl_inquiry) * fcscount, GFP_DMA|GFP_KERNEL);
 	if (!fcs) {
 		printk ("PLUTO: Not enough memory to probe\n");
 		return 0;


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2005-08-06  9:15 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-08-06  0:26 [PATCH] s390: fix invalid kmalloc flags benoit.boissinot
2005-08-06  0:36 ` Andrew Morton
2005-08-06  2:00   ` Benjamin LaHaise
2005-08-06  2:05     ` Andrew Morton
2005-08-06  9:15       ` [PATCH] fix invalid kmalloc flags (GFP_DMA alone) Benoit Boissinot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).