Re: JMicron Raid Problems on a Gigabyte GA-P35-DS3

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Andreas, et al.

For completenes, this is the patch in .rc15.

Andreas, et al.

For completeness, this is the patch in .rc15.
Maybe you can give it a go and report if it works for you as well ?

Heinz

--- 1.0.0.rc14/lib/format/ataraid/jm.c  2006-09-22 17:24:03.000000000 +0200
+++ current/lib/format/ataraid/jm.c     2007-04-19 11:05:34.000000000 +0200
@@ -1,8 +1,8 @@
 /*
  * JMicron metadata format handler.
  *
- * Copyright (C) 2006  Heinz Mauelshagen, Red Hat GmbH.
- *                     All rights reserved.
+ * Copyright (C) 2006,2007  Heinz Mauelshagen, Red Hat GmbH.
+ *                          All rights reserved.
  *
  * See file LICENSE at the top of this source tree for license information.
  */
@@ -25,25 +25,27 @@
 static char *name(struct lib_context *lc, struct raid_dev *rd,
                  unsigned int subset)
 {
+       int i;
        size_t len;
        struct jm *jm = META(rd, jm);
-       char buf[2], *ret, *name = (char *) jm->name;
+       char buf[JM_NAME_LEN + 1], *ret, *name = (char *) jm->name;
 
-       /* Name always 0 terminated ? */
-       if ((len = strlen(name)) > JM_NAME_LEN)
-               len = JM_NAME_LEN;
-
-       len += sizeof(HANDLER) + 2;
-       if (jm->mode == JM_T_RAID01)
-               len++;
+       /* Name always 0 terminated or whitespace at end ? */
+       strncpy(buf, name, JM_NAME_LEN);
+       len = strlen(buf);
+       i = len < JM_NAME_LEN ? len : JM_NAME_LEN;
+       buf[i] = 0;
+       while (i-- && isspace(buf[i]))
+               buf[i] = 0;
 
+       len = strlen(buf) + sizeof(HANDLER) + (jm->mode == JM_T_RAID01 ? 3 : 2);
        if ((ret = dbg_malloc(len))) {
                if (jm->mode == JM_T_RAID01 && subset)
                        sprintf(buf, "-%u", member(jm) / 2);
                else
                        *buf = 0;
 
-               sprintf(ret, "%s_%s%s", HANDLER, name, buf);
+               sprintf(ret, "%s_%s%s", handler, name, buf);
        }
 
        return ret;


On Mon, Oct 15, 2007 at 11:11:09AM +1000, Phil Higgins wrote:
> If you want to give it a go, see below.
> It's fairly simple - just copying the string to a temporary buffer big enough to hold the maximum length name plus null termination, then working backwards stripping the spaces out by replacing them with nulls.
> 
> I don't know if it's necessary for all Jmicron controllers or just the Gigabyte motherboard ones - but it shouldn't cause anything bad to happen under any circumstances.
> 
> Philip Higgins.
> 
> ---------
> --- 1.0.0.rc14/lib/format/ataraid/jm.c	2007-10-15 09:59:28.000000000 +1000
> +++ 1.0.0.rc14-fixed/lib/format/ataraid/jm.c	2007-10-15 10:21:50.000000000 +1000
> @@ -29,8 +29,22 @@
>  	struct jm *jm = META(rd, jm);
>  	char buf[2], *ret, *name = (char *) jm->name;
>  
> -	/* Name always 0 terminated ? */
> -	if ((len = strlen(name)) > JM_NAME_LEN)
> +	char namebuf[JM_NAME_LEN+1]; 
> +	strncpy(namebuf,name,JM_NAME_LEN);
> +	namebuf[JM_NAME_LEN] = '\0';
> +
> +	int i;
> +
> +	for (i=JM_NAME_LEN; i>0; i--)
> +	{
> +		if (namebuf[i] == ' ')
> +			namebuf[i] = '\0';
> +		else
> +			break;
> +	}
> +
> +	/* Name always 0 terminated ? - It is now. */
> +	if ((len = strlen(namebuf)) > JM_NAME_LEN)
>  		len = JM_NAME_LEN;
>  
>  	len += sizeof(HANDLER) + 2;
> @@ -43,7 +57,7 @@
>  		else
>  			*buf = 0;
>  
> -		sprintf(ret, "%s_%s%s", HANDLER, name, buf);
> +		sprintf(ret, "%s_%s%s", HANDLER, namebuf,buf);
>  	}
>  
>  	return ret;
> ---------
> If patch is mangled by Outlook, grab from http://shadowsystems.com.au/jmicron.patch
> 
> -----Original Message-----
> From: ataraid-list-bounces@xxxxxxxxxx [mailto:ataraid-list-bounces@xxxxxxxxxx] On Behalf Of Andreas Geringer
> Sent: Saturday, 13 October 2007 2:16 AM
> To: ATARAID (eg, Promise Fasttrak, Highpoint 370) related discussions
> Subject: Re: JMicron Raid Problems on a Gigabyte GA-P35-DS3
> 
> If it is not too much to do for you, I would like to try the patch.
> 
> I have another sata-device without raid with the new gentoo-system. So 
> it is not really urgent for me.  I think I have also the time to wait 
> for the new version.
> 
> Andreas Geringer
> 
> 
> No virus found in this outgoing message.
> Checked by AVG Free Edition. 
> Version: 7.5.488 / Virus Database: 269.14.10/1070 - Release Date: 14/10/2007 9:22 AM
>  
> 
> _______________________________________________
> Ataraid-list mailing list
> Ataraid-list@xxxxxxxxxx
> https://www.redhat.com/mailman/listinfo/ataraid-list

-- 

Regards,
Heinz    -- The LVM Guy --

*** Software bugs are stupid.
    Nevertheless it needs not so stupid people to solve them ***

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

Heinz Mauelshagen                                 Red Hat GmbH
Consulting Development Engineer                   Am Sonnenhang 11
Storage Development                               56242 Marienrachdorf
                                                  Germany
Mauelshagen@xxxxxxxxxx                            PHONE +49  171 7803392
                                                  FAX   +49 2626 924446
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

_______________________________________________
Ataraid-list mailing list
Ataraid-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/ataraid-list

[Index of Archives]     [Linux RAID]     [Linux Device Mapper]     [Linux IDE]     [Linux SCSI]     [Kernel]     [Linux Books]     [Linux Admin]     [GFS]     [RPM]     [Yosemite Campgrounds]     [AMD 64]

  Powered by Linux